Skip to content

Commit 1c11e27

Browse files
Tweak error/exception handler registration
1 parent 9ae1957 commit 1c11e27

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

FrameworkBundle.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
use Symfony\Component\Mime\DependencyInjection\AddMimeTypeGuesserPass;
6161
use Symfony\Component\PropertyInfo\DependencyInjection\PropertyInfoPass;
6262
use Symfony\Component\Routing\DependencyInjection\RoutingResolverPass;
63+
use Symfony\Component\Runtime\SymfonyRuntime;
6364
use Symfony\Component\Serializer\DependencyInjection\SerializerPass;
6465
use Symfony\Component\Translation\DependencyInjection\TranslationDumperPass;
6566
use Symfony\Component\Translation\DependencyInjection\TranslationExtractorPass;
@@ -91,7 +92,16 @@ class FrameworkBundle extends Bundle
9192
{
9293
public function boot()
9394
{
94-
ErrorHandler::register(null, false)->throwAt($this->container->getParameter('debug.error_handler.throw_at'), true);
95+
if (class_exists(SymfonyRuntime::class)) {
96+
$handler = set_error_handler('var_dump');
97+
restore_error_handler();
98+
} else {
99+
$handler = [ErrorHandler::register(null, false)];
100+
}
101+
102+
if (\is_array($handler) && $handler[0] instanceof ErrorHandler) {
103+
$handler[0]->throwAt($this->container->getParameter('debug.error_handler.throw_at'), true);
104+
}
95105

96106
if ($this->container->getParameter('kernel.http_method_override')) {
97107
Request::enableHttpMethodParameterOverride();

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
"symfony/mime": "<4.4",
8787
"symfony/property-info": "<4.4",
8888
"symfony/property-access": "<5.3",
89+
"symfony/runtime": "<5.4.45|>=6.0,<6.4.13|>=7.0,<7.1.6",
8990
"symfony/serializer": "<5.2",
9091
"symfony/service-contracts": ">=3.0",
9192
"symfony/security-csrf": "<5.3",

0 commit comments

Comments
 (0)