安裝Ecshop首頁出現報錯:Only variables should be passed by referen


 

1 php5.4下安裝的時候處理問題,Strict Standards: Non-static method cls_image::gd_version() should not be called statically in \install\includes\lib_installer.php on line 31

  解決:找到install/includes/lib_installer.php中的第31行   return cls_image::gd_version();然后在找到include/cls_image.php中的678行,發現gd_version()方法未聲明靜態static,所以會出錯。這時候只要:

  將function gd_version()改成static function gd_version()即可。

 

2 安裝好后出現Warning: require(languages//common.php): failed to open stream: No such file or directory in \includes\init.php on line 120

緩存問題 缺少配置信息 缺少文件temp\static_caches/shop_config.php

經測試在ecshop論壇http://help.ecshop.com/data/backup/ECShop_V2.7.3_UTF8_release1106.rar下載的文件有問題,重新到http://download.ecshop.com/2.7.3/ECShop_V2.7.3_UTF8_release1106.rar 下載后測試沒問題。

 

3 安裝好后出現 Strict standards: Only variables should be passed by reference in \includes\lib_main.php on line 1329

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

修改為: 

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

 Strict standards: Only variables should be passed by reference in \includes\cls_template.php on line 418

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

修改為:

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

 

array_shift() 的參數是引用傳遞的,5.3以上默認只能傳遞具體的變量,而不能通過函數返回值 end(&array) 也一樣(后面也會有end的函數,也需要拆分為兩行)。

 

修改后到后台更新緩存

 

4 后台 Strict standards: Redefining already defined constructor for class alipay in \includes\modules\payment\alipay.php on line 85

 后台更新緩存

 

5 Strict standards: mktime(): You should be using the time() function instead in \admin\sms_url.php on line 31
php版本問題  mktime()修改為  time()
 
6 Strict standards: Redefining already defined constructor for class alipay in \includes\modules\payment\alipay.php on line 85Call Stack

這里是php4與php5的區別
PHP4中構造方法是一個與類同名的方法,而從PHP5開始,用__construct()做為構造方法,但仍然支持PHP4的構造方法。如果同時使用的話,如果 同名方法在前的話,則會報錯

只需要把 function __construct()移到同名函數之前

 7 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 錯誤,別着急,先定位到出錯的文件,查找下是不是在程序中使用了”=&”,例如阿茲貓剛才定位到網站程序中發現了下圖的程序,發現使用了”=&”符號,去掉‘&’符號之后程序運行正常。
 
8  PHPStrict Standards: Declaration of ucenter::login() should be compatible with integrate::login($username, $password, $remember = NULL) in \includes\modules\integrates\ucenter.php on line 52 PHP 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 = '') in \includes\modules\integrates\ucenter.php on line 52 PHP Strict Standards: Declaration of ucenter::set_cookie() should be compatible with integrate::set_cookie($username = '', $remember = NULL) in \includes\modules\integrates\ucenter.php on line 52 
 
PHP5.4,子類的方法名如果和父類方法名相同,則子類的參數列表也要和父類的參數列相同。
修改接口文件里面的方法
 
9  ecshop2.7.3 gbk版在php5.4下安裝后,分類名稱文字不顯示問題
htmlspecialchars() 從 php5.4.0 版本開始第三個參數字符串編碼的默認值改成了 UTF-8,而ecshop2.7.3 gbk版的中文編碼是 GB2312 編碼的,跟現在的默認參數不一致,導致所有htmlspecialchars()處理的字符都無法顯示。
解決辦法:
$str_converted = htmlspecialchars($str, ENT_COMPAT ,'GB2312');
建議php5.4下不要安裝gbk編碼ecshop。


Strict Standards
: Only variables should be passed by reference in E:\Tools\ECShop_V2.7.3_UTF8_release1106\upload\includes\cls_template.php
on line 418
第418行:$tag_sel = array_shift(explode(' ', $tag));
解決辦法 1 
5.3以上版本的問題,應該也和配置有關 只要418行把這一句拆成兩句就沒有問題了  $tag_sel = array_shift(explode(' ', $tag)); 改成: $tag_arr = explode(' ', $tag);  $tag_sel = array_shift($tag_arr);
因為array_shift的參數是引用傳遞的,5.3以上默認只能傳遞具體的變量,而不能通過函數返回值 


 在安裝Ecshop的時候,遇到兩個問題:

  1.Strict Standards: Non-static method cls_image::gd_version() should not be called statically in D:\X\www\ecshop\install\includes\lib_installer.php on line 31

  解決:找到install/includes/lib_installer.php中的第31行   return cls_image::gd_version();然后在找到include/cls_image.php中的678行,發現gd_version()方法未聲明靜態static,所以會出錯。這時候只要:

  1)將function gd_version()改成static function gd_version()即可。

  2)或者將install/includes/lib_installer.php中的第31行return cls_image::gd_version();改成:

$p = new cls_image();
return $p->gd_version();

  2.檢測環境的時候提示:是否支持 JPEG是不支持的。

  解決:查看發現有libjpeg.lib庫,GD2庫也有,都加載了,也都正常。查看ecshop源代碼發現install/includes/lib_installer.php中第100行,JPEG寫成了JPG,正確的應該是:

 

$jpeg_enabled = ($gd_info['JPEG Support']        === true) ? $_LANG['support'] : $_LANG['not_support'];

 

  為何說Ecshop寫錯了,因為我打印數組$gd_info的時候,里面的鍵名是:JPEG Support。而$gd_info數組里的值都是直接調用系統環境變量的。

 

  3.默認時區問題:Warning: date_default_timezone_get(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in D:\X\www\ecshop\install\includes\lib_installer.php on line 225

  解決:方法1,將php.ini里是date.timezone前的";"去掉,改成:date.timezone = PRC;

  方法2,在頁頭使用 ini_set('date.timezone','Asia/Shanghai');

  方法3,在頁頭使用date_default_timezone_set()設置 date_default_timezone_set('PRC'); //東八時區 echo date('Y-m-d H:i:s');


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM