Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/226.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
更新到PHP5.4.9后出现静态标准错误_Php_Cakephp_Strict - Fatal编程技术网

更新到PHP5.4.9后出现静态标准错误

更新到PHP5.4.9后出现静态标准错误,php,cakephp,strict,Php,Cakephp,Strict,在将php更新到5.4版后,我遇到以下错误 Strict Standards: Non-static method Debugger::invoke() should not be called statically, assuming $this from incompatible context in /usr/share/php/cake/libs/debugger.php on line 575 Strict Standards: Non-static method Debugger:

在将php更新到5.4版后,我遇到以下错误

Strict Standards: Non-static method Debugger::invoke() should not be called statically, assuming $this from incompatible context in /usr/share/php/cake/libs/debugger.php on line 575 
Strict Standards: Non-static method Debugger::getInstance() should not be called statically, assuming $this from incompatible context in /usr/share/php/cake/libs/debugger.php on line 575
我已经尝试了以下解决方案

(无法找到“蛋糕”文件夹,因为我已烘焙了我的项目)

(无法关闭错误)


每次更改后,清除蛋糕缓存、web浏览器缓存、cookies并重新启动服务器。甚至在私人浏览和chrome、firefox、ie中也尝试过。

我相信这是因为该应用程序是基于旧版本的CakePHP构建的,可能会使用一些不推荐的功能。 如果你(或其他人)能将蛋糕升级到一个新的稳定的分支,那就太棒了。 现在,在您的core.php中尝试此操作,您可以从错误报告中删除E_STRICT:

i、 e转到app/Config/core.php查找

Configure::write('Error', array(
    'handler' => 'ErrorHandler::handleError',
    'level' => E_ALL & ~E_DEPRECATED,
    'trace' => true
));
替换为

Configure::write('Error', array(
    'handler' => 'ErrorHandler::handleError',
    'level' => E_ALL & ~E_STRICT & ~E_DEPRECATED,
    'trace' => true
));

更改错误报告功能可以解决此问题。然而,cakephp似乎在多个地方设置了这些标志,这就是为什么解决方案可能对您不起作用的原因(我也经历了同样的过程)

在源代码范围内搜索“错误报告”,您会发现它在多个文件中使用。尽可能添加标志“~E_STRICT”。例如:

error_reporting(E_ALL & ~E_STRICT & ~E_DEPRECATED);

你可以在/cake/bootstrap.php、/cake/libs/configure.php、/cake/console/cake.php等地方看到它。我只是将它们全部更改为排除E_STRICT,问题就解决了。

我搜索了整个项目以查找错误报告,并将其替换为错误报告(E_all&~E_STRICT&~E_弃用);直到我没有错误。