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中的678function gd_version()改成static function gd_version()

2.检测环境的时候提示:是否支持JPEG是不支持的。
解决:将install/includes/lib_installer.php中第98JPG修改成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()函数中用到的修饰符 /ePHP5.5.x 中已经被弃用了。
解决:打开文件includes/cls_template.php300

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

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

$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.php553行:

$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.php1069行:

$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.php332行:

$auth = mktime();

// 修改为:
$auth = time();
Ecshop安装过程中(PHP5.5.12)出现的几个错误

原文链接:https://beltxman.com/1439.html,若无特殊说明本站内容为 行星带 原创,未经同意禁止转载。

Ecshop安装过程中(PHP5.5.12)出现的几个错误”上有 5 条评论;

评论已关闭。

Scroll to top