【发布时间】:2016-05-15 00:37:08
【问题描述】:
似乎我在 php7.0.3 中发现了一些错误,但我不确定问题是否在我身边,所以我决定先写在这里
我最近将我的服务器 php 版本更新为 php7.0.3,当然还有关于不推荐使用的方法等的错误,我正在一一修复它们,直到我来到这个
未捕获的 TypeError:传递给 Debug::_exceptionHandler() 的参数 1 必须是 Exception 的实例,在 SomePath\Debug.php:518 中给出的错误实例 堆栈跟踪:#0 [内部函数]:Debug::_exceptionHandler(对象(错误))#1 {main} 抛出
我检查了Debug 类,发现set_exception_handler 和set_error_handler 在function enable() 中调用
public static function enable( ..some params.. ){
...
set_exception_handler(array(__CLASS__, '_exceptionHandler'));
set_error_handler(array(__CLASS__, '_errorHandler'));
}
// where _exceptionHandler function defined as
public static function _exceptionHandler(Exception $exception)
{ ... }
// and _errorHandler defined as
public static function _errorHandler($severity, $message, $file, $line, $context)
{ ... }
实际上错误对我来说很清楚,它告诉它不能将Error 类型对象传递给_exceptionHandler,因为它除了Exception 类型,但问题是为什么试图将它传递给_exceptionHandler 而不是_errorHandler,因为它也定义了?是错误还是我在 error 和 exception 处理程序的定义中遗漏了什么?
注意:我尝试使用 set_error_handler 将其作为第二个参数传递 E_ALL 等,但注意帮助...
我也收到了错误,应该由_errorHandler 处理,但由_exceptionHandler 处理是
未捕获的错误:调用 SomePath 中未定义的函数 set_magic_quotes_runtime()...
有人可以帮我解决这个问题吗?
谢谢
【问题讨论】:
标签: php error-handling exception-handling php-7