Skip to content

Commit c695435

Browse files
Merge branch '5.4' into 6.4
* 5.4: Tweak error/exception handler registration
2 parents 6a9665b + 1c11e27 commit c695435

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

FrameworkBundle.php

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
use Symfony\Component\PropertyInfo\DependencyInjection\PropertyInfoPass;
5959
use Symfony\Component\Routing\DependencyInjection\AddExpressionLanguageProvidersPass;
6060
use Symfony\Component\Routing\DependencyInjection\RoutingResolverPass;
61+
use Symfony\Component\Runtime\SymfonyRuntime;
6162
use Symfony\Component\Scheduler\DependencyInjection\AddScheduleMessengerPass;
6263
use Symfony\Component\Serializer\DependencyInjection\SerializerPass;
6364
use Symfony\Component\Translation\DependencyInjection\DataCollectorTranslatorPass;
@@ -99,13 +100,19 @@ public function boot()
99100
{
100101
$_ENV['DOCTRINE_DEPRECATIONS'] = $_SERVER['DOCTRINE_DEPRECATIONS'] ??= 'trigger';
101102

102-
$handler = ErrorHandler::register(null, false);
103+
if (class_exists(SymfonyRuntime::class)) {
104+
$handler = set_error_handler('var_dump');
105+
restore_error_handler();
106+
} else {
107+
$handler = [ErrorHandler::register(null, false)];
108+
}
103109

104-
// When upgrading an existing Symfony application from 6.2 to 6.3, and
105-
// the cache is warmed up, the service is not available yet, so we need
106-
// to check if it exists.
107-
if ($this->container->has('debug.error_handler_configurator')) {
108-
$this->container->get('debug.error_handler_configurator')->configure($handler);
110+
if (!$this->container->has('debug.error_handler_configurator')) {
111+
// When upgrading an existing Symfony application from 6.2 to 6.3, and
112+
// the cache is warmed up, the service is not available yet, so we need
113+
// to check if it exists.
114+
} elseif (\is_array($handler) && $handler[0] instanceof ErrorHandler) {
115+
$this->container->get('debug.error_handler_configurator')->configure($handler[0]);
109116
}
110117

111118
if ($this->container->getParameter('kernel.http_method_override')) {

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@
9393
"symfony/mime": "<6.4",
9494
"symfony/property-info": "<5.4",
9595
"symfony/property-access": "<5.4",
96+
"symfony/runtime": "<5.4.45|>=6.0,<6.4.13|>=7.0,<7.1.6",
9697
"symfony/scheduler": "<6.4.4|>=7.0.0,<7.0.4",
9798
"symfony/serializer": "<6.4",
9899
"symfony/security-csrf": "<5.4",

0 commit comments

Comments
 (0)