Today after the installation of Ecshop, running a variety of problems, including deprecated:preg_replace () such as the most error, the following post-solution:
Cause of Error:
The modifier used in the Preg_replace () function,/E, has been deprecated in php5.5.x.
If your PHP version happens to be php5.5.x, your ecshop will surely report an error similar to the following:
Deprecated:preg_replace (): the/e modifier is Deprecated, use Preg_replace_callback instead in ...
Workaround:
1. Deprecated:preg_replace (): the/e modifier is Deprecated, use Preg_replace_callback instead in \includes\cls_template. PHP on line 300
Original content:
return Preg_replace ("/{([^\}\{]*)}/e", "\ $this->select (' \\1 ');", $source);
Modified content:
return Preg_replace_callback ("/{([^\}\{]*)}/", function ($r) {return $this->select ($r [1]);}, $SOURC e);
2. Deprecated:preg_replace (): the/e modifier is Deprecated, use Preg_replace_callback instead in \includes\cls_template. PHP on line 491
Original content:
$out = "<?php ". ' $k = '. Preg_replace ("/(\ ' \\$[^,])/E", "Stripslashes (Trim (' \\1 ', ' \ '));", Var_export ($t, True)). "; ";
Modified content:
$out = "<?php ". ' $k = '. Preg_replace_callback ("/(\ ' \\$[^,])/", function ($match) {return stripslashes (Trim ($match [1], ' \ '));} , Var_export ($t, True)). "; "
3. Deprecated:preg_replace (): the/e modifier is Deprecated, use Preg_replace_callback instead in \includes\cls_template. PHP on line 550
Original content:
$val = Preg_replace ("/\[([^\[\]]*) \]/eis", "'. '). Str_replace (' $ ', ' \$ ', ' \\1 ') ", $val);
Modified content:
$val = preg_replace_callback ('/\[([^\[\]]*) \]/is ',function ($matches) { Return '. '. Str_replace (' $ ', ' \$ ', $matches [1]); },$val);
4 . Deprecated:preg_replace (): the/e modifier is Deprecated, use Preg_replace_callback instead in \includes\cls_template.ph P on line 1074
Original content:
$source = preg_replace ($pattern, $replacement, $source);
Modified content:
$source = Preg_replace_callback ($pattern, function ($matches) {return ' {include file= '. Strtol Ower ($matches [1]). '} ';},$source);
5. Strict standards:only variables should be passed by reference in ... \upload\includes\lib_main.php on line 1329
Original content:
$ext = End (Explode ('. ', $tmp));
Modified content:
$extsub = Explode ('. ', $tmp);
$tmp = End ($extsub);
$tmp = basename ($tmp, ". $ext");
Finally, the error is modified and uploaded to the server. Then go backstage, empty the cache, and refresh the page.
Ecshop How to Solve Deprecated:preg_replace () error