Echshop的二次开发,当安装好Ecshop V2.7.3发现出现了很多Bugs,首页几乎不能显示了。 Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in 【意思是:致命错误,preg_replace()函数中的/e模式被遗弃了,请使用preg_replace_callback()函数来替用】 第二种: Strict standards: Only variables should be passed by reference in【严格标准:变量应该通过引用来使用】 第三种: Strict standards: Non-static method cls_image::gd_version() should not be called statically in【严格标准:不属于静态方法cls_image::gd_version()不能静态的调用】 其余问题都是一些小毛病,根据提示就可以改掉,不再说明(这里的修改在php5.5.12下测试完美通过)
下面我们来一一解决: 原有内容: return preg_replace("/{([^\}\{\n]*)}/e", "\$this->select('\\1');", $source); 修改后内容: return preg_replace_callback("/{([^\}\{\n]*)}/", function($matches) { return $this->select($matches[1]); }, $source); \includes\cls_template.php on line 493 原有内容: $out = "<?php \n" . '$k = ' . preg_replace("/(\'\\$[^,]+)/e" , "stripslashes(trim('\\1','\''));", var_export($t, true)) . ";\n"; 修改后内容: $out = "<?php \n".'$k = '.preg_replace_callback("/(\'\\$[^,]+)/", function($matches){return stripslashes(trim($matches[1],'\''));}, var_export($t, true)) . ";\n"; \includes\cls_template.php on line 551 原有内容: //$val = preg_replace("/\[([^\[\]]*)\]/eis", "'.'.str_replace('$','\$','\\1')", $val); 修改后内容: $val = preg_replace_callback('/\[([^\[\]]*)\]/is',function ($matches) {return '.'.str_replace('$','\$',$matches[1]);},$val); \includes\cls_template.php on line 1070 原有内容: /* 将模板中所有library替换为链接 */ $pattern ='/<!--\s#BeginLibraryItem\s\"\/(.*?)\"\s-->.*?<!--\s#EndLibraryItem\s-->/se'; $replacement = "'{include file='.strtolower('\\1'). '}'";//zuimoban.com $source= preg_replace($pattern, $replacement, $source); 修改后内容: $pattern= '/<!--\s#BeginLibraryItem\s\"\/(.*?)\"\s-->.*?<!--\s#EndLibraryItem\s-->/s'; $replacement = "'{include file='.strtolower('\\1'). '}'"; $source = preg_replace_callback($pattern, function ($matches) { return '{include file='.strtolower($matches[1]). '}';},$source);
对于第二种问题: 原有内容: $tag_sel = array_shift(explode(' ', $tag)); 修改后内容: $arr = explode(' ', $tag); $tag_sel = array_shift($arr);
对于第三种问题:
原有内容:
return cls_image::gd_version();
修改后内容://zuimoban.com
$jeeinn = new cls_image();
$jeeinn->gd_version();
覆盖文件打包下载 https://yunpan.cn/crjML8Jt6LUFS (提取码:5df7)(责任编辑:最模板) |