How to eliminate php5 Strict standards errors?(如何消除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严格标准错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何消除php5严格标准错误?


基础教程推荐
- 如何替换eregi() 2022-01-01
- 学说 dbal querybuilder 作为准备好的语句 2022-01-01
- 有什么方法可以用编码 UTF-8 而不是 Unicode 返回 PHP`json_encode`? 2021-01-01
- PHP 类:全局变量作为类中的属性 2021-01-01
- 在PHP中根据W3C规范Unicode 2022-01-01
- 如何在 Laravel 中使用 React Router? 2022-01-01
- PHP PDO MySQL 查询 LIKE ->多个关键词 2021-01-01
- YouTube API v3 点赞视频,但计数器不增加 2022-01-01
- 如何在 Laravel 5.3 注册中添加动态下拉列表列? 2021-01-01
- Cron Jobs 调用带有变量的 PHP 脚本 2022-01-01