ecshop相容PHP版本較低,不相容PHP更高的版本,如果使用其他版本可能會出現各種錯誤,如以下七種錯誤問題:
1、Strict Standards: Non-static method cls_image::gd_version() should not be called statically
未聲明靜態static
將return cls_image::gd_version();
替換為
$p = new cls_image();
return $p->gd_version();
2、Strict Standards: Only variables should be passed by reference
變數應該通過引用傳遞
將$tag_sel = array_shift(explode(' ', $tag));
替換為
$tag_arr = explode(' ', $tag);
$tag_sel = array_shift($tag_arr);
3、Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in
將 return preg_replace("/{([^\}\{\n]*)}/e", "\$this->sel ect('\\1');", $source);
替換為
return preg_replace_callback ("/{([^\}\{\n]*)}/", function($r) { return $this->sel ect($r[1]); }, $source);
4、Strict Standards: Redefining already defined constructor for class paypal
PHP 類,有兩種建構函式,一種是跟類同名的函數,一種是 ____construct()。從PHP5.4開始,對這兩個函數出現的順序做了最嚴格的定義,必須是 ____construct() 在前,同名函數在後
例如:
function __construct()
{
$this->paypal();
}
function paypal()
{
}
5、mktime(): You should be using the time() function instead
mktime()方法不帶參數被調用
將$auth = mktime();
替換為
$auth = time();
6、Strict Standards: Declaration of vbb::set_cookie() should be compatible with integrate::set_cookie($username = '', $remember = NULL)
子類的函數跟父類的同名,必須使子類的函數參數跟父類的對應函數參數個數相同
依據錯誤提示,修改例如:
function set_cookie ($username="")
改為
function set_cookie ($username="", $remember = NULL)
7、Parse error: syntax error, unexpected ';'
語法錯誤,缺少;或者echo沒有輸出值