0

Please help. I'm getting this error:

( ! ) Warning: preg_match(): Unknown modifier 'b' in C:\wamp\www\pmd\install\ioncube_checker.php on line 22

When I run the following code:

function system_info($php_info) {
$server_info = array();
$server_info['thread_safe'] = 'false';
$server_info['debug_build'] = 'false';
$server_info['php_ini_path'] = '';

foreach (explode("\n",$php_info) as $line) {
    if (preg_match('/command/',$line)) {
        continue;
    }

    if (preg_match('/thread safety.*(enabled|yes)/Ui',$line)) {
        $server_info['thread_safe'] = 'true';
    }

    if (preg_match('/debug.*(enabled|yes)/Ui',$line)) {
        $server_info['debug_build'] = 'true';
    }


    if (preg_match("/configuration file.*(</b></td><TD ALIGN=\"left\">| => |v\">)([^ <]*)(.*</td>*)?/",$line,$match)) {
        $server_info['php_ini_path'] = $match[2];

        if (!@file_exists($php_ini_path)) {
            $server_info['php_ini_path'] = '';
        }
    }

    $cgi_cli = ((strpos(php_sapi_name(),'cgi') !== false) || (strpos(php_sapi_name(),'cli') !== false));
    $cgi_cli ? $server_info['cgi_cli'] = 'true' : $server_info['cgi_cli'] = 'false'; 
}
return $server_info;

}

Kevin Bedell
  • 13,254
  • 10
  • 78
  • 114

1 Answers1

1

Since you are using / as the regex delimiter you need to escape any / with a \. However, it's much easier to use a different delimiter when dealing with HTM:

preg_match("/configuration file.*(</b></td><TD ALIGN=\"left\">| => |v\">)([^ <]*)(.*</td>*)?/",$line,$match)

should be

preg_match("#configuration file.*(</b></td><TD ALIGN=\"left\">| => |v\">)([^ <]*)(.*</td>*)?#",$line,$match)

However, you should consider not using regexes to parse HTML at all - using a DOM engine is much better for it, and PHP already has one.

Community
  • 1
  • 1
ThiefMaster
  • 310,957
  • 84
  • 592
  • 636