概述
多是因为版本高于5.3的问题
1、Strict Standards: Only variables should be passed by reference in 418
找到第418行
$tag_sel = array_shift(explode(' ', $tag));
PHP5.3以上默认只能传递具体的变量,而不能通过函数返回值传递,所以这段代码中的explode就得移出来重新赋值了。
替换为:
$tagArr = explode(' ', $tag);
$tag_sel = array_shift($tagArr);
2、Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in includescls_template.php on line 300
找到300行
return preg_replace("/{([^}{]*)}/e", "$this->select('\1');", $source);
替换为:
return preg_replace_callback("/{([^}{]*)}/", function($r) { return $this->select($r[1]); }, $source);
mobile中替换为:
return preg_replace_callback("/{([^}{n]*)}/", function($r) { return $this->select($r[1]); }, $source);
3、Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in includescls_template.php on line 491
找到491行
$out = "<?php " . '$k = ' . preg_replace("/('\$[^,] )/e" , "stripslashes(trim('\1','''));", var_export($t, true)) . ";";
替换为:
$out = "<?php n" . '$k = ' . preg_replace_callback("/('\$[^,]+)/" , function($r) {return stripslashes(trim($r[1],'''));}, var_export($t, true)) . ";n";
4、Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in includescls_template.php on line 550
找到550行
$val = preg_replace("/[([^[]]*)]/eis", "'.'.str_replace('$','$','\1')", $val);
替换为:
$val = preg_replace_callback('/[([^[]]*)]/is',function ($matches) {return '.'.str_replace('$','$',$matches[1]);},$val);
5、Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in includescls_template.php on line 1074
找到1074行
$source = preg_replace($pattern, $replacement, $source);
替换为:
$source = preg_replace_callback($pattern, function ($matches) { return '{include file='.strtolower($matches[1]). '}';},$source);
同时,修改上面前两行的
$pattern = '/<!--s#BeginLibraryItems"/(.*?)"s-->.*?<!--s#EndLibraryItems-->/se';
把最后的e去掉
6、Strict Standards: Redefining already defined constructor for class cod in /Applications/MAMP/htdocs/shoptest1/includes/modules/payment/cod.php on line 82
PHP 类,有两种构造函数,一种是跟类同名的函数,一种是 ____construct()。从PHP5.4开始,对这两个函数出现的顺序做了最严格的定义,必须是 ____construct() 在前,同名函数在后。类似这种报错都可以这样解决,把____construct函数放到前面。
最后
以上就是贤惠外套为你收集整理的Ecshop 运行报错总结的全部内容,希望文章能够帮你解决Ecshop 运行报错总结所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复