Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in ...

Ecshop解决Deprecated: preg_replace()报错:

网上查找了很多资料总结完善的可用的,其中1、2、4都试过更改过可用,其余的我这边没报错就没亲身试过是否可行了。

错误原因:
  preg_replace() 函数中用到的修饰符 /e 在 PHP5.5.x 中已经被弃用了。
  如果你的PHP版本恰好是PHP5.5.X,那你的ECSHOP肯定就会报类似下面这样的错误:
  Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in……

解决办法:

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

    原有内容:

      return preg_replace("/{([^\}\{]*)}/e", "\$this->select('\\1');", $source);

    修改后内容:

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



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

    原有内容:

      $out = "<?php " . '$k = ' . preg_replace("/(\'\\$[^,] )/e" , "stripslashes(trim('\\1','\''));", var_export($t, true)) . ";\n";

    修改后内容: 

      $out = "<?php " . '$k = ' . preg_replace_callback("/(\'\\$[^,] )/" , function($match){return stripslashes(trim($match[1],'\''));}, var_export($t, true)) . ";\n";



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

    原有内容:

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

    修改后内容:

      $val = preg_replace_callback('/\[([^\[\]]*)\]/is',function ($matches) {return '.'.str_replace('$','\$',$matches[1]);},$val);



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

    原有内容注释:

      $pattern     = '/<!--\s#BeginLibraryItem\s\"\/(.*?)\"\s-->.*?<!--\s#EndLibraryItem\s-->/se';
          $replacement = "'{include file='.strtolower('\\1'). '}'";
          $source      = preg_replace($pattern, $replacement, $source);

    修改后内容:

      $pattern = '/<!--\s#BeginLibraryItem\s\"\/(.*?)\"\s-->.*?<!--\s#EndLibraryItem\s-->/s';
          $replacement = function($r){return '{include file='.strtolower($r[1]). '}';}; 
          $source = preg_replace_callback($pattern, $replacement, $source);



  5. Strict Standards: Only variables should be passed by reference in ...\upload\includes\lib_main.php on line 1329

    原有内容:

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

    修改后内容:

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

      $tmp = end($extsub);

      $tmp = basename($tmp,".$ext");



最后,将错误修改后,上传到服务器.然后进入后台,清空缓存,刷新页面即可。
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Calling tool in ralgen.py: /hpc/simulation/jzhou/awakening_soc/infra/flow/dv/tools/ralgen/../../../../util/regtool.py -s -t /tmp/mct_dv_bb_env-ral_0.1cvwdpui1 /hpc/simulation/jzhou/awakening_soc/design/bb/dv/env/../../data/bb.hjson RAL pkg for bb written to /tmp/mct_dv_bb_env-ral_0.1cvwdpui1. INFO: Wrote dependency graph to /hpc/simulation/jzhou/awakening_soc/scratch/default/gnss_top-sim-vcs/default/sim-vcs/mct_dv_bb_sim_0.1.deps-after-generators.dot WARNING: The file ../../include/yuu_ahb_interface.svi in /hpc/simulation/jzhou/awakening_soc/infra/verif/uvc/yuu_ahb/src/sv/ahb_env.core is not within the directory containing the core file. This is deprecated and will be an error in a future FuseSoC version. A typical solution is to move core file into the root directory of the IP block it describes WARNING: The file ../../include/yuu_ahb_pkg.sv in /hpc/simulation/jzhou/awakening_soc/infra/verif/uvc/yuu_ahb/src/sv/ahb_env.core is not within the directory containing the core file. This is deprecated and will be an error in a future FuseSoC version. A typical solution is to move core file into the root directory of the IP block it describes. WARNING: The file ../../test/ahb_base_seq.sv in /hpc/simulation/jzhou/awakening_soc/infra/verif/uvc/yuu_ahb/src/sv/ahb_env.core is not within the directory containing the core file. This is deprecated and will be an error in a future FuseSoC version. A typical solution is to move core file into the root directory of the IP block it describes. ERROR: Setup failed : Cannot find ../../test/ahb_base_seq.sv in : /hpc/simulation/jzhou/awakening_soc/infra/verif/uvc/yuu_ahb/src/sv
最新发布
07-20
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值