From 06ab7ecbeb06a581f2a3d3bb35c451911ae37cd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Pineau?= Date: Wed, 31 May 2023 12:11:02 +0200 Subject: [PATCH] [FrameworkBundle] ease migration to symfony 6.3 --- src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php b/src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php index 36e5cd4028010..339b28e83c695 100644 --- a/src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php +++ b/src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php @@ -98,7 +98,13 @@ public function boot() $_ENV['DOCTRINE_DEPRECATIONS'] = $_SERVER['DOCTRINE_DEPRECATIONS'] ??= 'trigger'; $handler = ErrorHandler::register(null, false); - $this->container->get('debug.error_handler_configurator')->configure($handler); + + // When upgrading an existing Symfony application from 6.2 to 6.3, and + // the cache is warmed up, the service is not available yet, so we need + // to check if it exists. + if ($this->container->has('debug.error_handler_configurator')) { + $this->container->get('debug.error_handler_configurator')->configure($handler); + } if ($this->container->getParameter('kernel.http_method_override')) { Request::enableHttpMethodParameterOverride();