8000 [HttpKernel] Skip logging uncaught exceptions in `ErrorHandler`, assume `$kernel->terminateWithException()` will do it by nicolas-grekas · Pull Request #58289 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[HttpKernel] Skip logging uncaught exceptions in ErrorHandler, assume $kernel->terminateWithException() will do it #58289

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

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[HttpKernel] Skip logging uncaught exceptions in ErrorHandler, assume…
… $kernel->terminateWithException() will do it
  • Loading branch information
nicolas-grekas committed Sep 17, 2024
commit 3b87c327fb1ebd3dbd67c8a2679c167fda152a28
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public function configure(?object $event = null)
return;
}
$this->firstCall = $this->hasTerminatedWithException = false;
$hasRun = null;

$handler = set_exception_handler('is_int');
$handler = \is_array($handler) ? $handler[0] : null;
Expand Down Expand Up @@ -144,6 +145,19 @@ public function configure(?object $event = null)
if ($this->exceptionHandler) {
if ($handler instanceof ErrorHandler) {
$handler->setExceptionHandler($this->exceptionHandler);
if (null !== $hasRun) {
$throwAt = $handler->throwAt(0) | \E_ERROR | \E_CORE_ERROR | \E_COMPILE_ERROR | \E_USER_ERROR | \E_RECOVERABLE_ERROR | \E_PARSE;
$loggers = [];

foreach ($handler->setLoggers([]) as $type => $log) {
if ($type & $throwAt) {
$loggers[$type] = [null, $log[1]];
}
}

// Assume $kernel->terminateWithException() will log uncaught exceptions appropriately
$handler->setLoggers($loggers);
}
}
$this->exceptionHandler = null;
}
Expand Down
Loading
0