ecshop在在PHP5.6.6版本以后,有了很多细微的变化。而ECSHOP官方更新又太慢,发现这些问题后也不及时升级,导致用户安装使用过程中错误百出。
整理一下我遇到的问题希望对你们能有些帮组也为了自己以后查看。
问题1:
Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in cls_template.php XXX line
出错原因:
出现以上问题是 preg_replace() 函数中用到的修饰符 /e 在 PHP5.5.x 中已经被弃用了。在PHP 5.5以上的版本用 preg_replace_callback 函数替换了 preg_replace函数。
解决方法:
解决问题的方法就是将代码中使用 preg_replace 函数的部分全部替换成 preg_replace_callback 函数,并且将一被废弃的 /e 修饰符 删除。
例子:
return preg_replace(\”/{([^\\}\\{\\n]*)}/e\”, \”\\$this->sel ect(\’\\\\1\’);\”, $source);
替换为
return preg_replace_callback(\”/{([^\\}\\{\\n]*)}/\”, function($r) { return $this->sel ect($r[1]); }, $source);
问题2:
Strict Standards: Only variables should be passed by reference in ……\\includes\\cls_template.php on line 418
出错原因:
出现这个问题的原因,貌似在php5.4中array_shift只能为变量,不能是函数返回值。
解决方法:
$tag_sel = array_shift(explode(‘ ‘, $tag));
替换成
$tag_arr = explode(‘ ‘, $tag);
$tag_sel = array_shift($tag_arr);
问题3:
Strict Standards: Non-static method cls_image::gd_version() should
not be called statically in ……\\includes\\lib_base.php on line 346
或者
Strict Standards: Non-static method cls_image::gd_version() should
not be called statically in ……\\includes\\lib_installer.php on line 31
出错原因: //www.zuimoban....