ecshop以及一些须要注意的

Deprecated: Assigning the return value of new by reference is deprecated inphp

定位到出错的那一行:html

[php]  view plain copy print ?
 
  1. $this->_ole =& new OLERead();  

我本地环境用的是PHP/5.3.3。sql

下面这段话引用于因思而变cookie

解决办法:php5.3开始后,废除了php中的”=&”符号,因此要想复制,直接用=引用便可。详细以下:dom

一、PHP5对象复制是采用引用的方式;
二、若是不采用引用方式,则须要在复制对象时加关键字 clone;
三、若是在复制的过程当中,同时要变动某些属性,则增长函数_clone();函数

 

 

在PHP5.3以上版本运行ecshop出现的问题及解决方案

 

ecshop网站

 

问题一:商城首页报错 Strict Standards: Only variables should be passed by reference in D:\wamp\ecshop\includes\cls_template.php on line 422this

解决方法:google

找到提示错误的文件 cls_template.php 及行号url

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

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

而且删除 D:\wamp\www\ecshop\temp\caches下全部的文件

 

问题二:后台首页报错 Strict Standards: Non-static method cls_image::gd_version() should not be called statically in D:\wamp\www\ecshop\includes\lib_base.php on line 346

解决办法

找到D:\wamp\www\ecshop\includes\cls_image.php文件

搜索 function gd_version 改为 static function gd_version

 

问题三:后台-商店设置 

Strict Standards: mktime(): You should be using the time() function instead in D:\wamp\www\ecshop\admin\sms_url.php on line 31
Strict Standards: mktime(): You should be using the time() function instead in D:\wamp\www\ecshop\admin\shop_config.php on line 32

解决办法

根据错误提示 把 mktime() 改为 time()

 

 

问题四:后台-起始页

Strict Standards: Redefining already defined c**tructor for class alipay in D:\www\es\includes\modules\payment\alipay.php on line 85

解决办法

1)、错误缘由:
PHP 类,有两种构造函数,一种是跟类同名的函数,一种是 __contruct()。从PHP5.4开始,对这两个函数出现的顺序作了最严格的定义,必须是 __c**truct() 在前,同名函数在后

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

  1.    function alipay()    {
  2.     }
  3.  
  4.     function __contruct()
  5.     {
  6.         $this->alipay();
  7.     }


3)、ECSHOP的不少类文件 都存在这个问题,都须要修改掉。

 

 

问题五:后台-数据备份 

 Strict standards: Redefining already defined constructor for class cls_sql_dump in D:\wamp\www\ecshop\admin\includes\cls_sql_dump.php on line 90
Strict standards: Non-static method cls_sql_dump::get_random_name() should not be called statically in D:\wamp\www\ecshop\admin\database.php on line 64

解决办法

根据错误提示 把 cls_sql_dump的 function __construct()改到  function cls_sql_dump()的前面

把 cls_sql_dump的 function get_random_name()改为 static  function get_random_name()

 

 

问题六:

 

Deprecated: Assigning the return value of new by reference is deprecated in  \admin\sitemap.php on line 46

 $sm     =& new google_sitemap();

 

解决办法

在5.3版本以后已经不容许在程序中使用”=&”符号。若是你的网站出现了Deprecated: Assigning the return value of new by reference is deprecated in 错误,别着急,先定位到出错的文件,查找下是否是在程序中使用了”=&”,例如刚才定位到网站程序中发现了下图的程序,发现使用了”=&”符号,去掉‘&’符号以后程序运行正常

 

 

问题七:

Declaration of phpbb::set_cookie() should be compatible with integrate::set_cookie...

解决办法:把function set_cookie ($username="") 改成function set_cookie ($username="", $remember = NULL)便可

 

问题八:

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

解决办法:

我碰见了有两处,都在cls_template.php文件中:

 一、return preg_replace("/{([^\}\{\n]*)}/e", "\$this->sel ect('\\1');", $source);
替换为
return preg_replace_callback("/{([^\}\{\n]*)}/", function($r) { return $this->sel ect($r[1]); }, $source);
问题解决。

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

  替换为

 $val= preg_replace_callback("/\[([^\[\]]*)\]/eis",function($r){return str_replace('$','\$',$r[1]);}, $val);

问题解决

相关文章
相关标签/搜索