phpUnit未显示PHP致命错误的堆栈跟踪 [英] PhpUnit not showing a stack trace for a php fatal error
问题描述
PhpUnit当前未显示代码中发生的PHP错误的堆栈跟踪.
PhpUnit is currently not showing the stack trace for PHP errors that occur in the code.
我如何配置它?
推荐答案
PHPUnit uses an error handler function to trap and display errors, but from the PHP manual on error handlers,
以下错误类型不能为 用用户定义的函数处理: E_ERROR,E_PARSE,E_CORE_ERROR, E_CORE_WARNING,E_COMPILE_ERROR, E_COMPILE_WARNING,以及大多数 E_STRICT在文件中提出的地方 set_error_handler()被调用.
The following error types cannot be handled with a user defined function: E_ERROR, E_PARSE, E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR, E_COMPILE_WARNING, and most of E_STRICT raised in the file where set_error_handler() is called.
如果在单独的进程中运行测试,PHPUnit将从解释器中获取错误和消息,但是将没有可用的堆栈跟踪.这只是PHP解释器的局限性.致命表示致命.
If you are running tests in a separate process, PHPUnit will get the error and message from the interpreter, but there will be no stack trace available. This is simply a limitation of the PHP interpreter. Fatal means fatal.
这篇关于phpUnit未显示PHP致命错误的堆栈跟踪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!