当php版本为5.6时的提示信息解决方法

ecshop修饰符preg_replace/e不安全的几处改动

Strict standards: Only variables should be passed by reference in D:\wamp64\www\includes\lib_main.php on line 1329

 

主要集中在 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: //zuimoban.com  转载不带网址,木JJ

 

   原语句:

   $val = preg_replace("/\[([^\[\]]*)\]/eis", "'.'.str_replace('$','\$','\\1')", $val);

 

    修改为:

    $val = preg_replace_callback("/\[([^\[\]]*)\]/is",

                    function ($matcher) {

                        return '.'.str_replace('$','\$',$matcher[1]);

                    },   

     $val);

 

  4:line 1071:

 

    原语句:

    $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);

 

5:line 419:

原语句:

$tag_sel = array_shift(explode(' ', $tag));

 

修改为:

$tag_val = explode(' ', $tag);

$tag_sel = array_shift($tag_val);

 

在upload/includes/lib_main.php 文件中

1:line  1329:

原始语句:

$ext = end(explode('.', $tmp));

修改为:

$tmp_val = explode('.', $tmp);

$ext = end($tmp_val);

 

修改完后记得在后台中点击清除缓存进行生效。

posted on 2018-02-23 13:18  流星飞雨  阅读(258)  评论(0编辑  收藏  举报

导航