如何消除php5严格的标准错误? [英] How to eliminate php5 Strict standards errors?
问题描述
将我的PHP升级到5.4.3(WAMP服务器2.2)后,我在CakePHP 1.3中创建的Web应用程序在我的索引中显示以下错误:
严格的标准:重新定义已经定义的类Object的构造函数在C:\ ... \cake\cake\libs\object.php在第63行
严格标准:非静态方法Configure :: getInstance()不应该在C:\ ... \cake\cake\bootstrap.php在第49行静态调用
$ c $经过一些研究,我发现有些人通过将php.ini文件中的error_reporting设置为E_ALL&〜来解决这个问题。 E_STRICT。
我在两个php.ini文件(C:\wamp\bin\php\php5.4.3和C:\wamp \bin\apache\apache2.4.2\bin),我在我的电脑,它没有解决我的问题。
我也试过把php_value error_reporting 6143在C:... \cake.htaaccess,但没有成功。
有人知道我该如何解决这个问题? (我不能升级我的CakePHP因为firebird)
解决方案 php 5.4的一个变化是E_STRICT现在的一部分E_ALL
因此,在您的/cake/bootstrap.php中,您可以从错误报告中删除E_STRICT:
error_reporting(E_ALL ^ E_STRICT);
并且可以与5.4之前的版本兼容。
After upgrading my PHP to 5.4.3 (WAMP server 2.2), my web app made in CakePHP 1.3, is showing the following errors in my index:
Strict standards: Redefining already defined constructor for class Object in C:\...\cake\cake\libs\object.php on line 63
Strict standards: Non-static method Configure::getInstance() should not be called statically in C:\...\cake\cake\bootstrap.php on line 49
After some research I've found that some people solve this problem by setting the "error_reporting" in php.ini file to "E_ALL & ~E_STRICT".
I did that in both php.ini files (C:\wamp\bin\php\php5.4.3 and C:\wamp\bin\apache\apache2.4.2\bin) that I have in my computer, and it didn't solve my problem.
I also tried to put "php_value error_reporting 6143" in C:...\cake.htaaccess but without success.
Does anybody know how can I solve this? (I can't upgrade my CakePHP because firebird)
解决方案 One of the changes in php 5.4 is that E_STRICT is now part of E_ALL
So, in your /cake/bootstrap.php you could remove the E_STRICT from your error reporting:
error_reporting(E_ALL ^ E_STRICT);
and be compatible again with before 5.4 versions.
这篇关于如何消除php5严格的标准错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!