解决ecshop2.7.3在PHP5.5环境下的BUG

解决ecshop2.7.3在PHP5.5环境下的BUG

错误:Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in C:\wamp\www\ecshop3\includes\cls_template.php on line 300
//return preg_replace(“/{([^\}\{\n]*)}/e”, “\$this->select(‘\\1′);”, $source);
修改:

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

错误:Strict standards: Only variables should be passed by reference in C:\wamp\www\ecshop3\includes\cls_template.php on line 423
修改:

1
2
$tagArr = explode(' ', $tag);
$tag_sel = array_shift($tagArr);

错误:
Strict standards: Redefining already defined constructor for class cls_sql_dump in C:\wamp\www\ecshop3\admin\includes\cls_sql_dump.php on line 90

类的构造方法,位置颠倒,__construct()前置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/**
     *  类的构造函数
     *
     * @access  public
     * @param
     *
     * @return void
     */
    function __construct(&$db, $max_size =0)
    {
        $this->cls_sql_dump($db, $max_size);
    }
    /**
     *  类的构造函数
     *
     * @access  public
     * @param
     *
     * @return void
     */
    function cls_sql_dump(&$db, $max_size=0)
    {
        $this->db = &$db;
        if ($max_size > 0 )
        {
            $this->max_size = $max_size;
        }
 
}

错误:Strict standards: Non-static method cls_sql_dump::get_random_name() should not be called statically in C:\wamp\www\ecshop3\admin\database.php on line 64
修改:get_random_name()为静态:

1
static function get_random_name()

错误:Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in C:\wamp\www\ecshop3\includes\cls_template.php on line 1075
修改为:

1
2
3
4
5
//$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';
$source = preg_replace_callback($pattern, function($ro){return '{include file='.strtolower($ro[1]). '}';}, $source);

错误:Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in C:\wamp\www\ecshop3\includes\cls_template.php on line 497

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

错误: Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in C:\wamp\www\ecshop3\includes\cls_template.php on line 556

修改为:

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

错误:Strict standards: Only variables should be passed by reference in C:\wamp\www\ecshop3\includes\lib_main.php on line 1332
解决:

1
2
3
//$ext = end(explode('.', $tmp));
$tmp_arr = explode('.', $tmp);
$ext = end($tmp_arr);

错误:Deprecated: Assigning the return value of new by reference is deprecated in C:\wamp\www\ecshop3\includes\lib.debug.php on line 303
修改为:

1
2
//$pa = &new Print_a_class;
$pa = new Print_a_class;

Strict Standards: Redefining already defined constructor for class paypal

PHP 类,有两种构造函数,一种是跟类同名的函数,一种是 ____construct()。从PHP5.4开始,对这两个函数出现的顺序做了最严格的定义,必须是 ____construct() 在前,同名函数在后
例如:
function __construct()
{
$this->paypal();
}

function paypal()
{
}
mktime(): You should be using the time() function instead
mktime()方法不带参数被调用
将$auth = mktime();
替换为

1
$auth = time();

Strict Standards: Declaration of vbb::set_cookie() should be compatible with integrate::set_cookie($username = ”, $remember = NULL)

子类的函数跟父类的同名,必须使子类的函数参数跟父类的对应函数参数个数相同
依据错误提示,修改例如:
function set_cookie ($username=””)
改为

1
function set_cookie ($username="", $remember = NULL)

会员整合中的其他类似的提示,相同的修改方式

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值