diff --git a/src/Whoops/Exception/Inspector.php b/src/Whoops/Exception/Inspector.php index 62c195bb..6cd78c15 100644 --- a/src/Whoops/Exception/Inspector.php +++ b/src/Whoops/Exception/Inspector.php @@ -195,8 +195,7 @@ public function getFrames() protected function getTrace($e) { // Use xdebug to get the full stack trace and remove the shutdown handler stack trace - if (extension_loaded('xdebug') && xdebug_is_enabled() - && $e instanceof \ErrorException && Misc::isLevelFatal($e->getSeverity())) { + if ($this->useXdebugForTrace($e)) { $stack = array_reverse(xdebug_get_function_stack()); $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); @@ -206,6 +205,18 @@ protected function getTrace($e) return $e->getTrace(); } + /** + * Determine if we should use xdebug for our stack trace + * + * @param \Throwable $e + * @return bool + */ + protected function useXdebugForTrace($e) + { + return extension_loaded('xdebug') && xdebug_is_enabled() + && $e instanceof \ErrorException && Misc::isLevelFatal($e->getSeverity()); + } + /** * Given an exception, generates an array in the format * generated by Exception::getTrace()