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

news/2024/7/3 3:13:02
主要集中在 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);

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


http://www.niftyadmin.cn/n/3658347.html

相关文章

面向构件,效率推动创新

人的天性中皆有创造的潜力&#xff0c;可是大多数人不肯去挖掘&#xff0c;因为懒惰。– 周国平长夜&#xff1a;中国的软件产业似乎还处在漫漫长夜之中&#xff0c;众多软件厂商们一头是疲于奔命般的应对下游客户的要求&#xff1a;不断变化的需求、更低的成本、更快的交付&am…

深度学习之GRU网络

深度学习之GRU网络

软件公司的十亿美元之炊

在业界有这样的一个不成文的定律&#xff0c;即独立软件公司在做到10亿美元时将会遇上一个难以逾越的坎。从历史来看有16家公司达到了10亿美元的销售额&#xff0c;可是目前只剩下了6家。而那十家都销声匿迹了。PeopleSoft、Siebel、Informix..... 这些公司并非说不能养活自己&…

交叉编译简单教程

交叉编译简单教程

arm_neon指令集优化

arm_neon指令集优化

踩坑日记:#error “NEON support not enabled“

cmake交叉编译报错&#xff1a; google一番&#xff0c;看起来有帮助的答案&#xff1a; https://stackoverflow.com/questions/35474573/clang-arm-neon-support 大概意思是要用-mfloat-abisoftfp 或者 -mfloat-abihard编译指令&#xff0c;尝试一下&#xff0c;没用。 https…