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

主要集中在 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 = "

修改为:

$replacement = preg_replace_callback("/(\'\\$[^,]+)/" ,
                                              function($matcher){
                              return stripslashes(trim($matcher[1],'\''));
                          },
                   var_export($t, true));
                     $out = "

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:line 1071:

/* 将模板中所有library替换为链接 */
          原  //$pattern     = '/.*?/se';
            $pattern = '/.*?/s';
            $replacement = "'{include file='.strtolower('\\1'). '}'";
          原  //$source      = preg_replace($pattern, $replacement, $source);
            $source = preg_replace_callback($pattern, function($ro){return '{include file='.strtolower($ro[1]). '}';}, $source);

二、后台错误
ECShop安装之后,在后台发现一个错误提示:

Strict Standards: mktime(): You should be using the time() function instead in E:\web\shopex\admin\shop_config.php on line 32

这个错误提示的意思:mktime()方法不带参数被调用时,会被抛出一个报错提示。

找到文件第32行:

$auth = mktime();

将mktime()替换成time()方法,代码为:

$auth = time();

你可能感兴趣的:(ecshop修饰符preg_replace/e不安全的几处改动)