首页  >  文章  >  后端开发  >  ecshop修饰符preg_replace/e不安全的几处改动

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

WBOY
WBOY原创
2016-08-08 09:20:30767浏览
主要集中在 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: //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);

原文地址:http://www.moke8.com/article-10688-1.html

以上就介绍了ecshop修饰符preg_replace/e不安全的几处改动,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn