[HttpKernel] Configure the ErrorHandler even when it is overriden
This commit is contained in:
parent
10f3b10978
commit
31817b48e2
@ -33,6 +33,7 @@ use Symfony\Component\HttpKernel\KernelEvents;
|
|||||||
*/
|
*/
|
||||||
class DebugHandlersListener implements EventSubscriberInterface
|
class DebugHandlersListener implements EventSubscriberInterface
|
||||||
{
|
{
|
||||||
|
private $earlyHandler;
|
||||||
private $exceptionHandler;
|
private $exceptionHandler;
|
||||||
private $logger;
|
private $logger;
|
||||||
private $levels;
|
private $levels;
|
||||||
@ -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)
|
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->exceptionHandler = $exceptionHandler;
|
||||||
$this->logger = $logger;
|
$this->logger = $logger;
|
||||||
$this->levels = null === $levels ? \E_ALL : $levels;
|
$this->levels = null === $levels ? \E_ALL : $levels;
|
||||||
@ -79,6 +84,10 @@ class DebugHandlersListener implements EventSubscriberInterface
|
|||||||
$handler = \is_array($handler) ? $handler[0] : null;
|
$handler = \is_array($handler) ? $handler[0] : null;
|
||||||
restore_exception_handler();
|
restore_exception_handler();
|
||||||
|
|
||||||
|
if (!$handler instanceof ErrorHandler && !$handler instanceof LegacyErrorHandler) {
|
||||||
|
$handler = $this->earlyHandler;
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->logger || null !== $this->throwAt) {
|
if ($this->logger || null !== $this->throwAt) {
|
||||||
if ($handler instanceof ErrorHandler || $handler instanceof LegacyErrorHandler) {
|
if ($handler instanceof ErrorHandler || $handler instanceof LegacyErrorHandler) {
|
||||||
if ($this->logger) {
|
if ($this->logger) {
|
||||||
|
Reference in New Issue
Block a user