前天無意修改了php.ini關於錯誤輸出的設置,今天測試一個CakePHP開發的項目時竟然發現多了幾條錯誤提示,雖然不是致命的但也不能忽視。
錯誤的描述大概如下:www.2cto.com
Strict Standards: Redefining already defined constructor for class Object in D:\www\hosts\cake\ucake-libs\cake\libs\object.php on line 69
Strict Standards: Assigning the return value of new by reference is deprecated in D:\www\hosts\cake\ucake-libs\cake\libs\object.php on line 94
Strict Standards: Assigning the return value of new by reference is deprecated in D:\www\hosts\cake\ucake-libs\cake\libs\security.php on line 48
Strict Standards: Assigning the return value of new by reference is deprecated in D:\www\hosts\cake\ucake-libs\cake\libs\inflector.php on line 65
Strict Standards: Assigning the return value of new by reference is deprecated in D:\www\hosts\cake\ucake-libs\cake\libs\configure.php on line 89
Strict Standards: Non-static method Configure::getInstance() should not be called statically in D:\www\hosts\cake\ucake-libs\cake\bootstrap.php on line 43
Strict Standards: Non-static method Configure::write() should not be called statically in D:\www\hosts\cake\ucake-libs\cake\bootstrap.php on line 82
Strict Standards: Non-static method Configure::getInstance() should not be called statically in D:\www\hosts\cake\ucake-libs\cake\libs\configure.php on line 108
大概掃了幾眼,看到基本上是CakePHP框架的錯誤,在Google中搜索相關錯誤信息時發現其它框架也存在這種通病,無耐。。。
只好認真看了看錯誤的解釋,我理解的是:程序沒有按照PHP嚴格規定的模式編寫而給的警告。想到這點於是自己又測試了幾個以前寫的小程序,有的也會出現這個錯誤。看來以後自己得注意自己的編碼規范,不能一味的追求功能…
由於當前項目要進行調試,遂又將php.ini錯誤輸出重新定義為:error_reporting = E_ALL。將E_STRICT去掉了,重啟Apache…一切如常…
摘自 joy 's