ecshop 在高版本PHP下报错的解决方法

主要集中在 upload/includes/cls_template.php 文件中:
  1:line 300 :
  原语句:
  return preg_replace("/{([^\}\{\n]*)}/e", "\$this->select('\\1');", $source);
  修改为:
  return preg_replace_callback("/{([^\}\{\n]*)}/", function($r) { return $this->select($r[1]); }, $source);

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

  3:line 554: 
 原语句:
 $val = preg_replace("/\[([^\[\]]*)\]/eis", "'.'.str_replace('$','\$','\\1')", $val);
修改为:
 $val = preg_replace_callback("/\[([^\[\]]*)\]/is",function ($matcher) { return '.'.str_replace('$','\$',$matcher[1]); },    $val);

4  商品批量上传出现
Assigning the return value of new by reference is deprecated in admin\goods_batch.php on line 921
$filter = &new stdclass;
改成
$filter = new stdclass;


5.后台商店设置出现  You should be using the time() function instead in admin\sms_url.php on line 31
admin\shop_config.php on line 32
mktime()  修改为  time()

6.数据库备份出现 edefining already defined constructor for class cls_sql_dump

\admin\includes\cls_sql_dump.php on line 90
  function __construct(&$db, $max_size =0)
    {
        $this->cls_sql_dump($db, $max_size);
    }
移到function cls_sql_dump(&$db, $max_size=0)前面
Non-static method cls_sql_dump::get_random_name() admin\database.php on line 64
打开includes\cls_sql_dump.php
 479行 
function get_random_name()
修改成
static function get_random_name()

7.会员整合出现
phpbb::set_cookie() should be compatible with integrate
\includes\modules\integrates\phpbb.php on line 232
110行
function set_cookie ($username="")
修改成
function set_cookie ($username="", $remember = NULL)
includes\modules\integrates\phpwind6.php
ucenter.php  vbb.php也是这样修改
ucenter.php 210行修改成
 function add_user($username, $password, $email, $gender = -1, $bday = 0, $reg_date = 0, $md5password = '')
127行修改成
function login($username, $password, $remember = NULL)


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

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


9. ecshop的时候出现如下错误Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in \ecshop\includes\cls_template.php on line 300

打开ecshop的目录找到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);



10.ecshop提示Strict Standards: Non-static method cls_image::gd_version() should not be called statically inE:\wwwroot\weirenchou\includes\lib_base.php on line 346找到346行吧

return cls_image::gd_version()
替换成:
$p = new cls_image();
return $p->gd_version();


11.Warning: preg_replace_callback(): Modifier /e cannot be used with replacement callback in E:\Program Files\xampps\htdocs\upload\includes\cls_template.php on line 1075<pre name="code" class="php">$pattern  = '/<!--\s#BeginLibraryItem\s\"\/(.*?)\"\s-->.*?<!--\s#EndLibraryItem\s-->/s';
            //$replacement = "'{include file='.strtolower('\\1'). '}'";
            //$source      = preg_replace($pattern, $replacement, $source);
              $source  = preg_replace_callback($pattern,
                    function ($matcher) {
                        return '{include file='.strtolower($matcher[1]).'}'; 
                    },$source);

 
 
 
 
 


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值