-
-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add error code & show function arguments #125
base: master
Are you sure you want to change the base?
Changes from 6 commits
1b70e6e
017ad67
b5e3c60
cdbadac
20947a8
77764e7
e9928a1
0ab8034
8b79e26
7d369db
852c311
28b647d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,7 +51,7 @@ | |
private LoggerInterface $logger, | ||
private ThrowableRendererInterface $defaultRenderer, | ||
private ?EventDispatcherInterface $eventDispatcher = null, | ||
private int $exitShutdownHandlerDepth = 2 | ||
Check warning on line 54 in src/ErrorHandler.php GitHub Actions / mutation / PHP 8.1-ubuntu-latest
Check warning on line 54 in src/ErrorHandler.php GitHub Actions / mutation / PHP 8.1-ubuntu-latest
Check warning on line 54 in src/ErrorHandler.php GitHub Actions / mutation / PHP 8.1-ubuntu-latest
Check warning on line 54 in src/ErrorHandler.php GitHub Actions / mutation / PHP 8.1-ubuntu-latest
|
||
) { | ||
} | ||
|
||
|
@@ -69,7 +69,7 @@ | |
$renderer ??= $this->defaultRenderer; | ||
|
||
try { | ||
$this->logger->error(PlainTextRenderer::throwableToString($t), ['throwable' => $t]); | ||
Check warning on line 72 in src/ErrorHandler.php GitHub Actions / mutation / PHP 8.1-ubuntu-latest
Check warning on line 72 in src/ErrorHandler.php GitHub Actions / mutation / PHP 8.1-ubuntu-latest
Check warning on line 72 in src/ErrorHandler.php GitHub Actions / mutation / PHP 8.1-ubuntu-latest
Check warning on line 72 in src/ErrorHandler.php GitHub Actions / mutation / PHP 8.1-ubuntu-latest
|
||
return $this->debug ? $renderer->renderVerbose($t, $request) : $renderer->render($t, $request); | ||
} catch (Throwable $t) { | ||
return new ErrorData((string) $t); | ||
|
@@ -109,14 +109,14 @@ | |
return; | ||
} | ||
|
||
if ($this->memoryReserveSize > 0) { | ||
Check warning on line 112 in src/ErrorHandler.php GitHub Actions / mutation / PHP 8.1-ubuntu-latest
Check warning on line 112 in src/ErrorHandler.php GitHub Actions / mutation / PHP 8.1-ubuntu-latest
Check warning on line 112 in src/ErrorHandler.php GitHub Actions / mutation / PHP 8.1-ubuntu-latest
Check warning on line 112 in src/ErrorHandler.php GitHub Actions / mutation / PHP 8.1-ubuntu-latest
|
||
$this->memoryReserve = str_repeat('x', $this->memoryReserveSize); | ||
} | ||
|
||
$this->initializeOnce(); | ||
Check warning on line 116 in src/ErrorHandler.php GitHub Actions / mutation / PHP 8.1-ubuntu-latest
Check warning on line 116 in src/ErrorHandler.php GitHub Actions / mutation / PHP 8.1-ubuntu-latest
|
||
|
||
// Handles throwable that isn't caught otherwise, echo output and exit. | ||
set_exception_handler(function (Throwable $t): void { | ||
Check warning on line 119 in src/ErrorHandler.php GitHub Actions / mutation / PHP 8.1-ubuntu-latest
Check warning on line 119 in src/ErrorHandler.php GitHub Actions / mutation / PHP 8.1-ubuntu-latest
|
||
if (!$this->enabled) { | ||
return; | ||
} | ||
|
@@ -130,12 +130,13 @@ | |
return false; | ||
} | ||
|
||
if (!(error_reporting() & $severity)) { | ||
Check warning on line 133 in src/ErrorHandler.php GitHub Actions / mutation / PHP 8.1-ubuntu-latest
Check warning on line 133 in src/ErrorHandler.php GitHub Actions / mutation / PHP 8.1-ubuntu-latest
|
||
// This error code is not included in error_reporting. | ||
return true; | ||
Check warning on line 135 in src/ErrorHandler.php GitHub Actions / mutation / PHP 8.1-ubuntu-latest
|
||
} | ||
|
||
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); | ||
$backtrace = debug_backtrace(); | ||
array_shift($backtrace); | ||
Check warning on line 139 in src/ErrorHandler.php GitHub Actions / mutation / PHP 8.1-ubuntu-latest
|
||
throw new ErrorException($message, $severity, $severity, $file, $line, null, $backtrace); | ||
}); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Omits unused index "object" and populates index "args". See https://www.php.net/manual/en/function.debug-backtrace.php