ECshop安装在PHP5.5.12环境下出现的报错

以下是ECshop安装在PHP5.5.12环境下出现的报错,从网上搜的,并亲自调试了一下,确实可靠,记录一下。
1.检查安装环境配置的时候报错:

Strict Standards: Non-static method cls_image::gd_version() should not be called statically in D:\X\www\ecshop\install\includes\lib_installer.php on line 31

原因:找到install/includes/lib_installer.php中的第31行 return cls_image::gd_version();然后在找到includes/cls_image.php中的678行,发现gd_version()方法未声明静态static。
解决:在includes/cls_image.php中的678行function gd_version()改成static function gd_version()。

2.检测环境的时候提示:是否支持JPEG是不支持的。
解决:将install/includes/lib_installer.php中第98行JPG修改成JPEG。

$jpeg_enabled = ($gd_info['JPEG Support']        === true) ? $_LANG['support'] : $_LANG['not_support'];

3.1安装完登录后台报错:

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in E:\phpDemo\ecshop\includes\cls_template.php on line 300

原因:在PHP5.5以上版本中preg_replace() 函数中用到的修饰符 /e 在 PHP5.5.x 中已经被弃用了。
解决:打开文件includes/cls_template.php将300行

return preg_replace("/{([^\}\{\n]*)}/e", "\$this->select('\\1');", $source);
 
修改为:
return preg_replace_callback("/{([^\}\{\n]*)}/", function($r) { return $this->select($r[1]); }, $source);

类似preg_replace() 函数中用到的修饰符 /e 提示替换 preg_replace_callback()的还有几处:
3.2文件includes/cls_template.php的493行:

$out = "<?php \n" . '$k = ' . preg_replace("/(\'\\$[^,]+)/e" , "stripslashes(trim('\\1','\''));", var_export($t, true)) . ";\n";
 
修改为:
$out = "<?php \n" . '$k = ' . preg_replace_callback("/(\'\\$[^,]+)/" , function($r) {return stripslashes(trim($r[1],'\''));}, var_export($t, true)) . ";\n";

3.3文件includes/cls_template.php的553行:

$val = preg_replace("/\[([^\[\]]*)\]/eis", "'.'.str_replace('$','\$','\\1')", $val);
 
修改为:
$val = preg_replace_callback("/\[([^\[\]]*)\]/", function($r) {return '.'.str_replace('$','$',$r[1]);}, $val);

3.4文件includes/cls_template.php的1069行:

$pattern = '/<!--\s#BeginLibraryItem\s\"\/(.*?)\"\s-->.*?<!--\s#EndLibraryItem\s-->/se';
$replacement = "'{include file='.strtolower('\\1'). '}'";
$source = preg_replace($pattern, $replacement, $source);
 
修改为:
$pattern = '/<!--\s#BeginLibraryItem\s\"\/(.*?)\"\s-->.*?<!--\s#EndLibraryItem\s-->/s';
$source = preg_replace_callback($pattern, function($r){return '{include file='.strtolower($r[1]). '}';}, $source);

4:错误信息:

Strict Standards: Only variables should be passed by reference in E:\web\shopex\includes\cls_template.php on line 422

原因:PHP5.3以上默认只能传递具体的变量,而不能通过函数返回值传递,所以这段代码中的explode就得移出来重新赋值。
解决:将includes\cls_template.php文件422行

$tag_sel = array_shift(explode(' ', $tag));
 
修改为:
$tag_arr = explode(' ', $tag);
$tag_sel = array_shift($tag_arr);

5.后台错误信息:

Strict standards: mktime(): You should be using the time() function instead in E:\phpDemo\ecshop\admin\sms_url.php on line 31

打开admin\sms_url.php文件第31行:
打开admin\shop_config.php第332行:

$auth = mktime();
 
修改为:
$auth = time();
posted @ 2017-04-15 12:58  Mr-Qiang  阅读(220)  评论(0编辑  收藏  举报