handle ecshop problem

1:  Strict Standards: Non-static method cls_image::gd_version() should not be called statically in   includes/cls_image.php

    解决:

                function gd_version()  ->   static function gd_version()

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

    解决:

               return preg_replace_callback("/{([^\}\{\n]*)}/", function($r) { return $this->select($r[1]); }, $source);

3:Strict Standards: Only variables should be passed by reference in includes\cls_template.php on line 424

    解决: 因为array_shift的参数是引用传递的,5.3以上默认只能传递具体的变量,而不能通过函数返回值

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

    注意:修改完之后,要到后台清理缓存,再到前台刷新页面即可

4:Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in \includes\cls_template.php on line 499

    解决:

                    $out = "<?php \n" . '$k = ' . //$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";

    注意:修改完之后,要到后台清理缓存,再到前台刷新页面即可

5:Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in \includes\cls_template.php on line 561

    解决:

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

6:  function smarty_prefilter_preCompile($source)

     /* 将模板中所有library替换为链接 */
     /*$pattern     = '/<!--\s#BeginLibraryItem\s\"\/(.*?)\"\s-->.*?<!--\s#EndLibraryItem\s-->/se';
       $replacement = "'{include file='.strtolower('\\1'). '}'";
       $source      = preg_replace($pattern, $replacement, $source);*/
       //bryan edit  to ->
       $pattern = '/<!--\s#BeginLibraryItem\s\"\/(.*?)\"\s-->.*?<!--\s#EndLibraryItem\s-->/s';
       $source = preg_replace_callback($pattern, function($ro){return '{include file='.strtolower($ro[1]). '}';}, $source);


7:function get_val($val)

    //bryan edit
    //$val = preg_replace("/\[([^\[\]]*)\]/eis", "'.'.str_replace('$','\$','\\1')", $val);
    $val = preg_replace_callback("/\[([^\[\]]*)\]/is", function($ro) {return '.'.str_replace('$','\$',$ro[1]);}, $val);


8:Strict Standards: Only variables should be passed by reference in E:\work\pro\php\ecshop\includes\lib_main.php on line 1329

    解決:

    //$ext = end(explode('.', $tmp));
   // -->
   $extArr = explode('.', $tmp);
   $ext = end($extArr);       










你可能感兴趣的:(handle ecshop problem)