Author Topic: PHP Deprecated: preg_match(): Passing null to parameter #2 ($subject) of type s  (Read 3012 times)

Offline mulyadi20

  • Newbie
  • *
  • Posts: 2
Hi All,

i used roundcube v1.6 in AlmaLinux9 with PHP8.1 cPanel and when i open webmail show error internal server error 500

this is logs tail /home/users/logs/.php.error.log

PHP Deprecated:  preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in /usr/local/cpanel/base/3rdparty/roundcube/program/lib/Roundcube/bootstrap.php on line 155

Please any advice how to fix this error

Thanks


Offline mulyadi20

  • Newbie
  • *
  • Posts: 2
this line 155

   if (preg_match('/([0-9\.]+)\s*([a-z]*)/i', $str, $regs)) {


        $bytes = floatval($regs[1]);
        switch (strtolower($regs[2])) {
        case 'g':
        case 'gb':
            $bytes *= 1073741824;
            break;
        case 'm':
        case 'mb':
            $bytes *= 1048576;
            break;
        case 'k':
        case 'kb':
            $bytes *= 1024;
            break;
        }
    }

Offline alec

  • Hero Member
  • *****
  • Posts: 1,365
This is not an error causing 500, you have to look for a real error in logs, not a deprecation warning.