Skip to content

Commit

Permalink
Merge branch '4.4' into 5.1
Browse files Browse the repository at this point in the history
* 4.4:
  [HttpKernel] Configure the ErrorHandler even when it is overriden
  Allow relative path to composer cache
  • Loading branch information
nicolas-grekas committed Jan 25, 2021
2 parents 0f6f25c + 8445c3a commit 1ffa7e9
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions EventListener/DebugHandlersListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
*/
class DebugHandlersListener implements EventSubscriberInterface
{
private $earlyHandler;
private $exceptionHandler;
private $logger;
private $deprecationLogger;
Expand All @@ -51,6 +52,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, LoggerInterface $deprecationLogger = null)
{
$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 Down Expand Up @@ -78,6 +83,10 @@ public function configure(object $event = null)
$handler = \is_array($handler) ? $handler[0] : null;
restore_exception_handler();

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

if ($handler instanceof ErrorHandler) {
if ($this->logger || $this->deprecationLogger) {
$this->setDefaultLoggers($handler);
Expand Down

0 comments on commit 1ffa7e9

Please sign in to comment.