8000 [HttpKernel] Configure the ErrorHandler even when it is overriden by nicolas-grekas · Pull Request #39944 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[HttpKernel] Configure the ErrorHandler even when it is overriden #39944

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 1 commit into from
Jan 23, 2021
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] Configure the ErrorHandler even when it is overriden
  • Loading branch information
nicolas-grekas committed Jan 22, 2021
commit 31817b48e23bf2705ac8fa076c7e690779a9f2ad
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
*/
class DebugHandlersListener implements EventSubscriberInterface
{
private $earlyHandler;
private $exceptionHandler;
private $logger;
private $levels;
Expand All @@ -53,6 +54,10 @@ class DebugHandlersListener implements EventSubscriberInterface
*/
public function __construct(callable $exceptionHandler = null, LoggerInterface $logger = null, $levels = \E_ALL, ?int $throwAt = \E_ALL, bool $scream = true, $fileLinkFormat = null, bool $scope = true)
{
$handler = set_exception_handler('var_dump');
$this->earlyHandler = \is_array($handler) ? $handler[0] : null;
restore_exception_handler();

$this->exceptionHandler = $exceptionHandler;
$this->logger = $logger;
$this->levels = null === $levels ? \E_ALL : $levels;
Expand All @@ -79,6 +84,10 @@ public function configure(Event $event = null)
$handler = \is_array($handler) ? $handler[0] : null;
restore_exception_handler();

if (!$handler instanceof ErrorHandler && !$handler instanceof LegacyErrorHandler) {
$handler = $this->earlyHandler;
}

if ($this->logger || null !== $this->throwAt) {
if ($handler instanceof ErrorHandler || $handler instanceof LegacyErrorHandler) {
if ($this->logger) {
Expand Down
0