致命错误,因为传递的是错误实例,而不是预期的异常实例 [英] Fatal error because an Error instance is being passed instead of an expected Exception instance

查看:160
本文介绍了致命错误,因为传递的是错误实例,而不是预期的异常实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚用PHP 7.0.4和一个新的Cakephp 3.2.6安装了xampp. 我做了很多研究,发现的一切都表明它们是兼容的.

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.

但是,一旦我使用浏览器打开应用程序,cake就会回答内部错误".

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

唯一的指示是xampp在apache error.log中记录以下内容:

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

PHP致命错误:未被捕获的TypeError:传递给Cake \ Error \ BaseErrorHandler :: handleException()的参数1必须是Exception的实例,D:\ Xampp \ htdocs \ cakephp \ vendor \ cakephp \ cakephp中给出的Error实例\ src \ Error \ BaseErrorHandler.php:153
堆栈跟踪:
#0 [内部函数]:Cake \ Error \ BaseErrorHandler-> handleException(Object(Error))
在第153行的D:\ Xampp \ htdocs \ cakephp \ vendor \ cakephp \ cakephp \ src \ Error \ BaseErrorHandler.php中抛出#1 {main}

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

我尝试了php 5.6,但是它仍然在日志中显示错误.

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

推荐答案

如果这是您遇到的错误,那么我会怀疑您使用的是CakePHP 3.2.6,因为第153行位于注释的中间

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

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

从CakePHP 3.1.5开始处理PHP7错误,因此请检查您的CakePHP依赖项,并确保它实际上是最新的.

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

这篇关于致命错误,因为传递的是错误实例,而不是预期的异常实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆