程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 網頁編程 >> PHP編程 >> 關於PHP編程 >> 如何看待PHP Strict Standards錯誤

如何看待PHP Strict Standards錯誤

編輯:關於PHP編程

 

前天無意修改了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

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved