skip to Main Content

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:wamp64scriptsconfig.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?

2

Answers


  1. 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

    Login or Signup to reply.
  2. The intent of your code fragment likely follows along these lines which is to fetch the current environment encoding and replace the array entries with actual values:

    $Text_Encoding = array(
        'IsSingleByte' => '',
        'BodyName' => '',
        'EncodingName' => '',
        'HeaderName' => '',
        'WebName' => '',
        'WindowsCodePage' => '',
        'CodePage' => '',
    );
    $command = 'CMD /D /C powershell [System.Text.Encoding]:: Default';
    $output = `$command`;
    foreach($Text_Encoding as $key => $value) {
        if(preg_match('~^'.$key.'s+:s+([a-zA-Z0-9-'.() ]+)~mi',$output,$matches) === 1) {
            $Text_Encoding[$key] = $matches[1];
        }
    }
    

    From this it appears that using $value is not what you want.

    Source: http://forum.wampserver.com/read.php?2,163848,163848

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search