Missing stack trace
firodj opened this issue · comments
whenever there are an erroe like E_COMPILE_ERROR
on child class, just like misuse use
statement, the stack trace doesnt point the original nor correct file.
this is depend on how the toString()
method handle the exception since toString
must not throw an Exception
.
} catch (Exception $error) {
- trigger_error($error->getMessage(), E_USER_ERROR);
+ $previousHandler = set_exception_handler(function () {});
+ restore_error_handler();
+ if (! $previousHandler) {
+ $str = $error->getMessage()."\n";
+ $str .= $error->getTraceAsString();
+ return $str;
+ } else {
+ call_user_func($previousHandler, $error);
+ }
+ die;
}