如何消除php5严格标准错误?

时间:2023-01-19
本文介绍了如何消除php5严格标准错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

将我的 PHP 升级到 5.4.3(WAMP 服务器 2.2)后,我在 CakePHP 1.3 中制作的网络应用程序在我的索引中显示以下错误:

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:

严格标准:重新定义类的已定义构造函数对象在 C:...cakecakelibsobject.php 第 63 行

Strict standards: Redefining already defined constructor for class Object in C:...cakecakelibsobject.php on line 63

严格的标准:非静态方法 Configure::getInstance() 应该不会在 C:...cakecakeootstrap.php 第 49 行中静态调用

Strict standards: Non-static method Configure::getInstance() should not be called statically in C:...cakecakeootstrap.php on line 49

我发现有些人通过将 php.ini 中的 error_reporting 设置为 E_ALL & 来解决这个问题.~E_STRICT.

I've found that some people solve this problem by setting the error_reporting in php.ini to E_ALL & ~E_STRICT.

我在计算机上的两个 php.ini 文件(C:wampinphpphp5.4.3 和 C:wampinapacheapache2.4.2in)中都这样做了,但没有解决问题.

I did that in both php.ini files (C:wampinphpphp5.4.3 and C:wampinapacheapache2.4.2in) present on my computer but it didn't solve the problem.

我也尝试将 php_value error_reporting 6143 放入 C:...cake.htaccess 但没有成功.

I also tried to put php_value error_reporting 6143 in C:...cake.htaccess but without success.

有谁知道我该如何解决这个问题?由于 firebird,我无法升级我的 CakePHP.

Does anybody know how can I solve this? I can't upgrade my CakePHP because of firebird.

推荐答案

php 5.4 的变化之一是 E_STRICT 现在是 E_ALL 的一部分

One of the changes in php 5.4 is that E_STRICT is now part of E_ALL

因此,在您的/cake/bootstrap.php 中,您可以从错误报告中删除 E_STRICT:

So, in your /cake/bootstrap.php you could remove the E_STRICT from your error reporting:

error_reporting(E_ALL ^ E_STRICT);

并再次兼容 5.4 之前的版本.

and be compatible again with before 5.4 versions.

这篇关于如何消除php5严格标准错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

上一篇:CakePHP 中的 base_url 下一篇:将变量从 PHP 传递到 JavaScript 的有效方法

相关文章

最新文章