我在更新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
我已经尝试了以下解决方案
在CakePHP中禁用错误报告时出错
Cakephp不工作后安装php5-curl包(无法找到"Cake"文件夹,因为我已经烤我的项目)
Wampserver cakephp 1.3严格标准错误
如何消除php5严格的标准错误?
PHP 5禁用严格标准错误
https://stackoverflow.com/questions/11799085/turn-off-php-strict-standards?lq=1(无法关闭错误)
清除蛋糕缓存,网页浏览器缓存,cookie和重启服务器后,每次更改。甚至在私人浏览和chrome, firefox, ie中也试过。
我相信这是因为这个应用程序是建立在旧版本的CakePHP上的,可能会使用一些过时的函数。到目前为止,在core.php中尝试一下,你可以从错误报告中删除E_STRICT:
。到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
));
修改error_reporting函数可以解决这个问题。然而,cakephp似乎在几个地方设置了这些标志,这就是为什么解决方案可能不适合您(我经历了相同的)
在源代码范围内搜索"error_reporting",您会发现它在几个文件中使用。可以在任何地方添加标志"~E_STRICT"。例如:
error_reporting(E_ALL & ~E_STRICT & ~E_DEPRECATED);
你会在/cake/bootstrap.php,/cake/libs/configure.php,/cake/console/cake.php等地方看到它。我只是把它们全部更改为排除E_STRICT,问题就解决了。