在PHP5.5下ecshop修正文件报错归类
2016-09-07 22:02 来源:www.chinab4c.com 作者:ecshop专家
| 
	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)(责任编辑:chinab4c) | 
最近更新
常用插件
- ecshop最小购买数量控制插
                                  ecshop最小购买数量控制插件,这个插件主要是为我们提供一个十分方便... 
- ecshop二次开发商品购买增
                                  图片1香... 
- ecshop2.7.2生成虚拟订单2.
                                  以前我们开发过ecshop下的虚拟订单,就是客户在访问的时候,会自动生... 
- ecshop2.7.1邮件发送插件
                                  ecshop2.7.1邮件发送插件:该插件主要的开发思想是源于ecshop短信发送系统... 
- ecshop没登陆情况下订单查
                                  ecshop没登陆情况下订单查询插件,主要是针对ecshop在没有登陆的情况下... 



