Search code examples
phpwamp

Deprecated: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated


I have installed WAMP Server 3.3.0 in my computer and after that when I go to localhost loading page displaying following error messages

Deprecated: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in C:\wamp64\scripts\config.inc.php on line 82

this is my config.inc.php

foreach($Text_Encoding as $key => $value) {
    if(preg_match('~^'.$key.'\s+:\s+(.+)~mi',$output,$matches) === 1) { //line 82
        $Text_Encoding[$key] = $matches[1];
    }
}

how could I fix this problem?


Solution

  • Look like you need to change by this ?

    foreach($Text_Encoding as $key => $value) {
        if(preg_match('~^'.$key.'\s+:\s+(.+)~mi', $value, $matches) === 1) { 
            $Text_Encoding[$key] = $matches[1];
        }
    }
    

    Your $output is not set and you don't use $value in your code