PHP5.6.6上运行 ecshop 2.7.3常见问题处理
ecshop在在PHP5.6.6版本以后,有了很多細微的變化。而ECSHOP官方更新又太慢,發現這些問題后也不及時升級,導致用戶安裝使用過程中錯誤百出。
整理一下我遇到的問題希望對你們能有些幫組也為了自己以后查看。
問題1:? ? ?
? Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in cls_template.php XXX line
出錯原因:
???出現以上問題是?preg_replace() 函數中用到的修飾符 /e 在 PHP5.5.x 中已經被棄用了。在PHP 5.5以上的版本用 preg_replace_callback 函數替換了 preg_replace函數。
解決方法:
解決問題的方法就是將代碼中使用 preg_replace 函數的部分全部替換成 preg_replace_callback 函數,并且將一被廢棄的 /e 修飾符 刪除。?
例子:?
? ?return preg_replace("/{([^\}\{\n]*)}/e", "\$this->sel ect('\\1');", $source);?
? ?替換為
? ?return preg_replace_callback("/{([^\}\{\n]*)}/", function($r) { return $this->sel ect($r[1]); }, $source);
?
問題2:
? ?Strict Standards: Only variables should be passed by reference in?......\includes\cls_template.php?on line?418
出錯原因:
? ?出現這個問題的原因,貌似在php5.4中array_shift只能為變量,不能是函數返回值。
解決方法:
? ?$tag_sel = array_shift(explode(‘ ‘, $tag));
? ?替換成
? ?$tag_arr = explode(‘ ‘, $tag);
? ?$tag_sel = array_shift($tag_arr);
?
問題3:?
? ?Strict Standards: Non-static method cls_image::gd_version() should not be called statically in?......\includes\lib_base.php?on line?346 ? 或者
? ?Strict Standards: Non-static method cls_image::gd_version() should not be called statically in ......\includes\lib_installer.php on line 31
出錯原因: ?//www.zuimoban.com
? ?如問題中提示的一樣,因為 cls_image.php 中 gd_version() 不是 static 函數所以在lib_base.php 與 lib_installer.php 中調用時才會出現以上問題。
解決方法:
解決方法1: ???首先在 lib_image.php 文件中,用 Shift+F 去搜索 gd_version 函數。然后在gd_version 方法前加 static 修飾符,是此函數變成靜態函數。
? ? 解決方法2: ? ?在lib_base.php 與 lib_installer.php 函數中找到 cls_image::gd_version() 部分, 然后分別創建cls_image 實例,之后用創建的實例再去調用 gd_version() 函數。
? ? ? ? ? ? ? ? ? ? ? $cls_gile = new cls_image();
? ? ? ? ? ? ? ? ? ? ? return $cls_gile->gd_version();
?
問題4:
? ?Deprecated: Assigning the return value of new by reference is deprecated in…
出錯原因:
? ?PHP5.3+廢除了”=&”符號,對象復制用”=”
解決方法:
? ?搜索所有PHP文件,將”=&”替換為”=”
問題5:
? ?Strict Standards: mktime(): You should be using the time() function instead in ......\admin\shop_config.php on line 32
出錯原因:
? ?這個錯誤提示的意思:mktime()方法不帶參數被調用時,會被拋出一個報錯提示。
解決方法:
? ?$auth = mktime();
? ?將mktime()替換成time()方法,代碼為:
? ?$auth = time();
?
問題6:
? ?Strict Standards: Redefining already defined constructor for class cls_sql_dump ......
出錯原因:
? ?原因跟PHP類中的構造函數有關,PHP早期版本是使用跟類同名的函數作為構造函數,后來又出現了使用 __construct()作為構造函數,
? ?這倆個函數可以同時存在。到了PHP5.4版本,對這倆個函數在代碼中的先后順序有了嚴格的要求。在PHP5.4版本下,必須__construct() 在前,
? ?同名函數在后,否則就會出現上面的的錯誤提示。
解決方法:
? ?把__construct()函數放在,同名函數上面就行了。
?
問題7:
? ?Strict Standards: Declaration of vbb::set_cookie() should be compatible with integrate::set_cookie($username = '', $remember = NULL)
出錯問題:
? ?vbb繼承了integrate類并且重寫了 set_cookie() 函數,但vbb重寫set_cookie函數的參數 與 其父類set_cookie 的參數不符所以出現以上問題。
解決方法:
? ?function set_cookie ($username="")
? ?改為
? ?function set_cookie ($username="", $remember = NULL)
? ?如出現類似錯誤,可以以同樣的方法解決。
轉載于:https://www.cnblogs.com/isungge/p/4829012.html
總結
以上是生活随笔為你收集整理的PHP5.6.6上运行 ecshop 2.7.3常见问题处理的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 关于CXF的FrontEnd和数据绑定方
- 下一篇: Google Guice结合模式