ecshop在php5.3以上运行提示问题修改大全

运行环境: linux nginx php5.4.16

1. ecshop提示Strict Standards: Only variables should be passed by reference in  /includes/cls_template.php

在/includes/cls_template.php找打

$tag_sel = array_shift(explode(' ', $tag));

改成:

$tag_arr = explode(' ', $tag); 
$tag_sel = array_shift($tag_arr);

2. Strict Standards: Non-static method cls_image::gd_version() should not be called statically in  includes\lib_base.php

找到includes/cls_image.php中的678行,发现gd_version()方法未声明静态static。

function gd_version()

改成

static function gd_version()

3. Deprecated: Assigning the return value of new by reference is deprecated in includes/lib.debug.php on line 303

将admin/goods_batch.php中

$filter = &new stdclass;

改为

$filter = new stdclass;

将includes/lib.debug.php中的

$pa = &new Print_a_class;

改为

$pa = new Print_a_class;

4. Strict Standards: mktime(): You should be using the time() function instead in shop_config.php

sms_url.php里面也有

$auth = mktime();

改为

$auth = time();

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

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

改为

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

6. Redefining already defined constructor for class…

所有的payment的文件都有这个问题,

其中使用和类名相同点函数名作为构造函数是php4时代的写法,php5时代的构造函数是 __construct(),ecshop为了兼容老版本的php,所以采用了上面的写法。

但是从php5.4开始,对于这样的两种写法同时出现的情况,要求必须__construct()在前,同名函数在后,所以只需要对调两个函数的位置即可。

解决方法:
调换一下两个函数的前后位置即可。
以 includes/modules/payment/alipay.php  为例:
将下面这两个函数的位置互换一下就OK了,__c**truct()在前,alipay()在后

**********************2016.11.21更新*********************

7. admin\includes\cls_sql_dump.php on line 90

把 cls_sql_dump的 function __construct()改到 function cls_sql_dump()的前面
把 cls_sql_dump的 function get_random_name()改成 static function get_random_name()

**********************2016.11.29更新*********************

8. Ucenter问题

Strict standards: Declaration of ucenter::login() should be compatible with integrate::login($username, $password, $remember = NULL)

修改includes\modules\integrates文件夹下的ucenter.php文件,大概在127行,

把 function login($username, $password)

改成 function login($username, $password, $remember = NULL)

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

把:set_cookie($username = ”)

修改为:set_cookie($username = ”, $remember = NULL)

Strict standards: Declaration of ucenter::add_user() should be compatible with integrate::add_user($username, $password, $email, $gender = -1, $bday = 0, $reg_date = 0, $md5password = ”)

找到    function add_user($username, $password, $email)
改为    function add_user($username, $password, $email, $gender = -1, $bday = 0, $reg_date = 0, $md5password = NULL)

**********************2016.12.01更新*********************

9. Notice: unserialize() [function.unserialize]: Error at offset 159 of 647 bytes in \eshop\includes\lib_common.php on line 224

在lib_common.php找到

if (empty($arr['integrate_code']))
{
    $arr['integrate_code'] = 'ecshop'; // 默认的会员整合插件为 ecshop } write_static_cache('shop_config', $arr);

改为

if (empty($arr['integrate_code']))
{
    $arr['integrate_code'] = 'ecshop'; // 默认的会员整合插件为 ecshop } if (!empty($arr['integrate_config']) && EC_CHARSET == 'utf-8') { $arr['integrate_config'] = preg_replace('!s:(\d+):"(.*?)";!se',"'s:'.strlen('$2').':\"$2\";'",str_replace(' ','',$arr['integrate_config'])); } write_static_cache('shop_config', $arr);
看完了?留个评分呗?
[0人评了分,平均: 0/5]

本站原创文章皆遵循“署名-非商业性使用-相同方式共享 3.0 (CC BY-NC-SA 3.0)”。转载请保留以下标注:

原文来源:《ecshop在php5.3以上运行提示问题修改大全》

发表评论

邮箱地址不会被公开。

返回顶部