includes/cls_template.php
错误提示:- Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in includes/cls_template.php on line 300
- return preg_replace("/{([^\}\{\n]*)}/e", "\$this->select('\\1');", $source);
- return preg_replace_callback("/{([^\}\{\n]*)}/", function($r) { return $this->select($r[1]); }, $source);
- $out = "<?php \n" . '$k = ' . preg_replace("/(\'\\$[^,]+)/e" , "stripslashes(trim('\\1','\''));", var_export($t, true)) . ";\n";
- $out = "<?php \n" . '$k = ' . preg_replace_callback("/(\'\\$[^,]+)/" , function($match){return stripslashes(trim($match[1],'\''));}, var_export($t, true)) . ";\n";
- $val = preg_replace("/\[([^\[\]]*)\]/eis", "'.'.str_replace('$','\$','\\1')", $val);
- $val = preg_replace_callback('/\[([^\[\]]*)\]/is',function ($matches) {return '.'.str_replace('$','\$',$matches[1]);},$val);
- $pattern = '/<!--\s#BeginLibraryItem\s\"\/(.*?)\"\s-->.*?<!--\s#EndLibraryItem\s-->/se';
- $pattern = '/<!--\s#BeginLibraryItem\s\"\/(.*?)\"\s-->.*?<!--\s#EndLibraryItem\s-->/s';
- $source = preg_replace($pattern, $replacement, $source);
- $source =preg_replace_callback($pattern, function($matcheb){ return '{include file='.strtolower($matcheb[1]). '}';}, $source);
mobile\include\vendor\phpmailer\class.phpmailer.php
如果有使用ectouch作为ecshop的手机移动客服端,那么还要修改这个文件mobile\include\vendor\phpmailer\class.phpmailer.php,这个文件有多个preg_replace函数使用了/e参数,具体如下: 1703行- $encoded = preg_replace("/([^A-Za-z0-9!*+\/ -])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded);
- $encoded =preg_replace_callback("/([^A-Za-z0-9!*+\/ -])/", function($ra) { return '='.sprintf('%02X', ord($ra[1]));}, $encoded);
- $encoded = preg_replace("/([\(\)\"])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded);
- $encoded = preg_replace_callback("/([\(\)\"])/", function($rb) { return '='.sprintf('%02X', ord($rb[1]));}, $encoded);
- $encoded = preg_replace('/([\000-\011\013\014\016-\037\075\077\137\177-\377])/e', "'='.sprintf('%02X', ord('\\1'))", $encoded);
- $encoded = preg_replace_callback('/([\000-\011\013\014\016-\037\075\077\137\177-\377])/', function($rc) { return '='.sprintf('%02X',ord($rc[1]));}, $encoded);
- Strict Standards: Only variables should be passed by reference in \includes\cls_template.php on line 418
$tag_sel = array_shift(explode(' ', $tag));
php5.6已经不允许这样相套使用了,更换为
$tag_arr = explode(' ', $tag); $tag_sel = array_shift($tag_arr);
\mobile\include\library\EcsTemplate.class.php
248行- return preg_replace("/{([^\}\{\n]*)}/e", "\$this->select('\\1');", $source);
- return preg_replace_callback("/{([^\}\{\n]*)}/", function($r) { return $this->select($r[1]);}, $source);
- $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";
- $val = preg_replace("/\[([^\[\]]*)\]/eis", "'.'.str_replace('$','\$','\\1')", $val);
- $val = preg_replace_callback("/\[([^\[\]]*)\]/is", function($r) { return '.'.str_replace('$','\$',$r[1]);}, $val);
- $pattern = '/<!--\s#BeginLibraryItem\s\"\/(.*?)\"\s-->.*?<!--\s#EndLibraryItem\s-->/se';
- $pattern = '/<!--\s#BeginLibraryItem\s\"\/(.*?)\"\s-->.*?<!--\s#EndLibraryItem\s-->/s';
- $source = preg_replace($pattern, $replacement, $source);
- $source =preg_replace_callback($pattern, function($matcheb){ return '{include file='.strtolower($matcheb[1]). '}';}, $source);
\mobile\include\common.php
662行- return ucfirst(preg_replace("/_([a-zA-Z])/e", "strtoupper('\\1')", $name));
- return ucfirst(preg_replace_callback("/_([a-zA-Z])/", function($r) { return strtoupper($r[1]);}, $name));
$ext = end(explode('.', $tmp));
修改为
$exta = explode('.', $tmp);$ext = end($exta);
还有php5.6版本弃用了split函数,需要修改,具体文件为goods.php
错误提示:
- Function split() is deprecated Error File: \goods.php on line 362
$cat_ar=split('/',$cat_name);
修改为
$cat_ar=explode('/',$cat_name);
需要正则表达式的就需要更换为preg_split函数,速度慢些。
修改了上面的这些问题后,前台的一般性警告或者错误提示就没有了,但是后台出现了蛮多问题。如下图
第一个,订单列表的订单状态为空,这个订单状态没有了很麻烦,不知道这个订单现在是什么状况。
错误状况:

- <td align="center" valign="top" nowrap="nowrap">{$lang.os[$order.order_status]},{$lang.ps[$order.pay_status]},{$lang.ss[$order.shipping_status]}</td>
- <td align="center" valign="top" nowrap="nowrap">{$lang.os.$order.order_status},{$lang.ps.$order.pay_status},{$lang.ss.$order.shipping_status}</td>


{$var.display_options[$k]}</label>
修改为
{$var.display_options.$k}</label>
修改好之后就能正常显示了。

- Strict Standards: mktime(): You should be using the time() function instead in ......\admin\shop_config.php on line 32
- Strict Standards: mktime(): You should be using the time() function instead in ......\admin\sms_url.php on line 31

$auth = mktime();
修改为
$auth = time();
总结归纳一下,php环境升级到5.6以后,主要变化就是书写规则的改变和函数或者其修饰符的改变,比如preg_replace的/e修饰符在5.6就弃用了,split函数和mktime函数在5.6不被支持了。修正preg_replace这个问题时有一个诀窍,就是一对引号对应一个function,大括号收之前必须要加php语句结束符号英文状态的引号;
,那么基本上就不会出错了。欢迎分享您发现的升级php5.6后ecshop存在的一些问题,一起进步,have a enjoy!