Fatal error because an Error instance is being passed instead of an expected Exception instance

◇◆丶佛笑我妖孽 提交于 2019-12-02 16:01:08

问题


I just installed xampp with php 7.0.4 and a fresh cakephp 3.2.6. I did a lot of research and everything I found shows that they are compatible.

However as soon as I go to open the application with a browser, cake replies with an Internal Error.

The only pointer as to what to do is that xampp logs the following in apache error.log:

PHP Fatal error: Uncaught TypeError: Argument 1 passed to Cake\Error\BaseErrorHandler::handleException() must be an instance of Exception, instance of Error given in D:\Xampp\htdocs\cakephp\vendor\cakephp\cakephp\src\Error\BaseErrorHandler.php:153
Stack trace:
#0 [internal function]: Cake\Error\BaseErrorHandler->handleException(Object(Error))
#1 {main} thrown in D:\Xampp\htdocs\cakephp\vendor\cakephp\cakephp\src\Error\BaseErrorHandler.php on line 153

I tried php 5.6 but it still shows the error in the log.


回答1:


If that's the error that you are encountering, then I'd doubt that you are using CakePHP 3.2.6, as line 153 is in the middle of a comment

https://github.com/cakephp/cakephp/blob/3.2.6/src/Error/BaseErrorHandler.php#L153

PHP7 errors are handled since CakePHP 3.1.5, so check your CakePHP dependency, and make sure it's actually up to date.



来源:https://stackoverflow.com/questions/36357981/fatal-error-because-an-error-instance-is-being-passed-instead-of-an-expected-exc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!