Skip to content

Commit 64443ff

Browse files
committed
Leverage get_error_handler()
1 parent 120056b commit 64443ff

File tree

5 files changed

+8
-6
lines changed

5 files changed

+8
-6
lines changed

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
"symfony/polyfill-intl-normalizer": "~1.0",
5656
"symfony/polyfill-mbstring": "~1.0",
5757
"symfony/polyfill-php83": "^1.28",
58+
"symfony/polyfill-php85": "^1.32",
5859
"symfony/polyfill-uuid": "^1.15"
5960
},
6061
"replace": {

src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,7 @@ public function boot(): void
103103
$_ENV['DOCTRINE_DEPRECATIONS'] = $_SERVER['DOCTRINE_DEPRECATIONS'] ??= 'trigger';
104104

105105
if (class_exists(SymfonyRuntime::class)) {
106-
$handler = set_error_handler('var_dump');
107-
restore_error_handler();
106+
$handler = get_error_handler();
108107
} else {
109108
$handler = [ErrorHandler::register(null, false)];
110109
}

src/Symfony/Bundle/FrameworkBundle/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"symfony/http-foundation": "^7.3|^8.0",
2929
"symfony/http-kernel": "^7.2|^8.0",
3030
"symfony/polyfill-mbstring": "~1.0",
31+
"symfony/polyfill-php85": "^1.32",
3132
"symfony/filesystem": "^7.1|^8.0",
3233
"symfony/finder": "^6.4|^7.0|^8.0",
3334
"symfony/routing": "^6.4|^7.0|^8.0"

src/Symfony/Component/ErrorHandler/ErrorHandler.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,12 @@ public static function register(?self $handler = null, bool $replace = true): se
116116
$handler = new static();
117117
}
118118

119-
if (null === $prev = set_error_handler([$handler, 'handleError'])) {
120-
restore_error_handler();
119+
if (null === $prev = get_error_handler()) {
121120
// Specifying the error types earlier would expose us to https://bugs.php.net/63206
122121
set_error_handler([$handler, 'handleError'], $handler->thrownErrors | $handler->loggedErrors);
123122
$handler->isRoot = true;
123+
} else {
124+
set_error_handler([$handler, 'handleError']);
124125
}
125126

126127
if ($handlerIsNew && \is_array($prev) && $prev[0] instanceof self) {
@@ -362,9 +363,8 @@ public function screamAt(int $levels, bool $replace = false): int
362363
private function reRegister(int $prev): void
363364
{
364365
if ($prev !== ($this->thrownErrors | $this->loggedErrors)) {
365-
$handler = set_error_handler(static fn () => null);
366+
$handler = get_error_handler();
366367
$handler = \is_array($handler) ? $handler[0] : null;
367-
restore_error_handler();
368368
if ($handler === $this) {
369369
restore_error_handler();
370370
if ($this->isRoot) {

src/Symfony/Component/ErrorHandler/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"require": {
1919
"php": ">=8.2",
2020
"psr/log": "^1|^2|^3",
21+
"symfony/polyfill-php85": "^1.32",
2122
"symfony/var-dumper": "^6.4|^7.0|^8.0"
2223
},
2324
"require-dev": {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy