bug #36342 [HttpKernel][FrameworkBundle] fix compat with Debug component (nicolas-grekas)
This PR was merged into the 4.4 branch.
Discussion
----------
[HttpKernel][FrameworkBundle] fix compat with Debug component
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix #36009
| License | MIT
| Doc PR | -
Fixes the issue as described by @stof in #36009
Commits
-------
d5c54c2fa7
[HttpKernel][FrameworkBundle] fix compat with Debug component
This commit is contained in:
commit
a56f98cbdc
@ -35,6 +35,7 @@ use Symfony\Component\Cache\DependencyInjection\CachePoolPass;
|
||||
use Symfony\Component\Cache\DependencyInjection\CachePoolPrunerPass;
|
||||
use Symfony\Component\Config\Resource\ClassExistenceResource;
|
||||
use Symfony\Component\Console\DependencyInjection\AddConsoleCommandPass;
|
||||
use Symfony\Component\Debug\ErrorHandler as LegacyErrorHandler;
|
||||
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
|
||||
use Symfony\Component\DependencyInjection\Compiler\RegisterReverseContainerPass;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
@ -89,6 +90,9 @@ class FrameworkBundle extends Bundle
|
||||
public function boot()
|
||||
{
|
||||
ErrorHandler::register(null, false)->throwAt($this->container->getParameter('debug.error_handler.throw_at'), true);
|
||||
if (class_exists(LegacyErrorHandler::class, false)) {
|
||||
LegacyErrorHandler::register(null, false)->throwAt($this->container->getParameter('debug.error_handler.throw_at'), true);
|
||||
}
|
||||
|
||||
if ($this->container->getParameter('kernel.http_method_override')) {
|
||||
Request::enableHttpMethodParameterOverride();
|
||||
|
@ -15,6 +15,7 @@ use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\Console\ConsoleEvents;
|
||||
use Symfony\Component\Console\Event\ConsoleEvent;
|
||||
use Symfony\Component\Console\Output\ConsoleOutputInterface;
|
||||
use Symfony\Component\Debug\ErrorHandler as LegacyErrorHandler;
|
||||
use Symfony\Component\Debug\Exception\FatalThrowableError;
|
||||
use Symfony\Component\ErrorHandler\ErrorHandler;
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
@ -79,7 +80,7 @@ class DebugHandlersListener implements EventSubscriberInterface
|
||||
restore_exception_handler();
|
||||
|
||||
if ($this->logger || null !== $this->throwAt) {
|
||||
if ($handler instanceof ErrorHandler) {
|
||||
if ($handler instanceof ErrorHandler || $handler instanceof LegacyErrorHandler) {
|
||||
if ($this->logger) {
|
||||
$handler->setDefaultLogger($this->logger, $this->levels);
|
||||
if (\is_array($this->levels)) {
|
||||
@ -138,7 +139,7 @@ class DebugHandlersListener implements EventSubscriberInterface
|
||||
}
|
||||
}
|
||||
if ($this->exceptionHandler) {
|
||||
if ($handler instanceof ErrorHandler) {
|
||||
if ($handler instanceof ErrorHandler || $handler instanceof LegacyErrorHandler) {
|
||||
$handler->setExceptionHandler($this->exceptionHandler);
|
||||
}
|
||||
$this->exceptionHandler = null;
|
||||
|
Reference in New Issue
Block a user