Ecshop卻沒(méi)來(lái)得及修改,如果在高版本的php虛擬主機(jī)上安裝ecshop程序,出現(xiàn)兼容性問(wèn)題。
小編在本地環(huán)境php5.5上安裝出現(xiàn)以下兩種報(bào)錯(cuò)提示:
Only variables should be passed by reference php
Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead…?
通過(guò)在網(wǎng)絡(luò)上查找,小編發(fā)現(xiàn)并不是只能在低版本的php中安裝,也是找到了解決辦法,方便大家在php5.5版本上調(diào)試程序。小編就在這里把解決方法分享給大家:
先說(shuō)明第一個(gè)問(wèn)題的解決方法:
php 5.3以上版本的問(wèn)題,和配置有關(guān) 只要418行把這一句拆成兩句就沒(méi)有問(wèn)題了。
將下列:
1
|
$tag_sel = array_shift ( explode ( ' ' , $tag )); |
修改為:
1
|
$tag_arr = explode ( ' ' , $tag ); $tag_sel = array_shift ( $tag_arr ); |
因?yàn)閍rray_shift的參數(shù)是引用傳遞的,5.3以上默認(rèn)只能傳遞具體的變量,而不能通過(guò)函數(shù)返回值
第二個(gè)報(bào)錯(cuò)解決辦法:
找到文件:include/cls_template.php
將以下代碼:
1
|
return preg_replace( "/{([^\}\{\n]*)}/e" , "\$this->select('\\1');" , $source ); |
修改成:
1
|
return preg_replace_callback( "/{([^\}\{\n]*)}/" , function ( $r ) { return $this ->select( $r [1]); }, $source ); |
小編目前只遇到這樣兩個(gè)報(bào)錯(cuò),如果在程序調(diào)試和開(kāi)發(fā)過(guò)程中遇到其他的問(wèn)題,如果能夠解決,小編也是會(huì)整理出解決方法的。
ecshop 在高版本PHP下報(bào)錯(cuò)的解決方法
1 .ecshop提示Strict Standards: Non-static method cls_image
1
|
::gd_version() should not be called statically inE:/wwwroot/weirenchou/includes/lib_base.php on line 346 |
找到346行吧
1
|
return cls_image::gd_version() |
替換成:
1
|
$p = new cls_image(); return $p ->gd_version(); |
2 .ecshop的時(shí)候出現(xiàn)如下錯(cuò)誤:
1
|
Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /ecshop/includes/cls_template.php on line 300 |
打開(kāi)ecshop的目錄找到includes/cls_template.php 到第300行
把
1
|
return preg_replace( "/{([^/}/{/n]*)}/e" , "/$this->select('//1');" , $source ); |
替換成
1
|
return preg_replace_callback( "/{([^/}/{/n]*)}/" , function ( $r ) { return $this ->select( $r [1]); }, $source ); |
3. Strict Standards: Only variables should be passed by reference in E:/web/shopex/includes/cls_template.php on line 422
1
|
$tag_sel = array_shift ( explode ( ' ' , $tag )); |
改成:
1
|
$tag_arr = explode ( ' ' , $tag ); $tag_sel = array_shift ( $tag_arr ); |
4 .會(huì)員整合出現(xiàn)
1
2
3
4
5
6
7
|
phpbb::set_cookie() should be compatible with integrate /includes/modules/integrates/phpbb.php on line 232 110行 function set_cookie ( $username = "" ) |
修改成
1
2
3
|
function set_cookie ( $username = "" , $remember = NULL) includes/modules/integrates/phpwind6.php |
ucenter.php vbb.php也是這樣修改
ucenter.php 210行修改成
1
|
function add_user( $username , $password , $email , $gender = -1, $bday = 0, $reg_date = 0, $md5password = '' ) |
127行修改成
1
|
function login( $username , $password , $remember = NULL) |
5. 數(shù)據(jù)庫(kù)備份出現(xiàn)
1
2
3
4
5
6
7
8
9
10
11
|
edefining already defined constructor for class cls_sql_dump /admin/includes/cls_sql_dump.php on line function __construct(& $db , $max_size =) { $this ->cls_sql_dump( $db , $max_size ); } |
移到function cls_sql_dump(&$db, $max_size=0)前面
1
|
Non- static method cls_sql_dump::get_random_name() admin/database.php on line 64 |
打開(kāi)includes/cls_sql_dump.php
479行
1
|
function get_random_name() |
修改成
1
|
static function get_random_name() |