Skip to content

Commit 99c939a

Browse files
[ErrorHandler][VarDumper] Remove PHP 8.4 deprecations
1 parent b39ac01 commit 99c939a

File tree

4 files changed

+26
-13
lines changed

4 files changed

+26
-13
lines changed

src/Symfony/Component/ErrorHandler/ErrorHandler.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ class ErrorHandler
5555
\E_USER_DEPRECATED => 'User Deprecated',
5656
\E_NOTICE => 'Notice',
5757
\E_USER_NOTICE => 'User Notice',
58-
\E_STRICT => 'Runtime Notice',
5958
\E_WARNING => 'Warning',
6059
\E_USER_WARNING => 'User Warning',
6160
\E_COMPILE_WARNING => 'Compile Warning',
@@ -73,7 +72,6 @@ class ErrorHandler
7372
\E_USER_DEPRECATED => [null, LogLevel::INFO],
7473
\E_NOTICE => [null, LogLevel::WARNING],
7574
\E_USER_NOTICE => [null, LogLevel::WARNING],
76-
\E_STRICT => [null, LogLevel::WARNING],
7775
\E_WARNING => [null, LogLevel::WARNING],
7876
\E_USER_WARNING => [null, LogLevel::WARNING],
7977
\E_COMPILE_WARNING => [null, LogLevel::WARNING],
@@ -196,6 +194,12 @@ public function __construct(?BufferingLogger $bootstrappingLogger = null, bool $
196194
}, null, new class() extends \Exception {
197195
});
198196
$this->debug = $debug;
197+
198+
// BC layer for PHP < 8.4
199+
if (\defined('E_STRICT')) {
200+
$this->levels[\E_STRICT] = 'Runtime Notice';
201+
$this->loggers[\E_STRICT] = [$bootstrappingLogger, LogLevel::WARNING];
202+
}
199203
}
200204

201205
/**

src/Symfony/Component/ErrorHandler/Tests/ErrorHandlerTest.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,6 @@ public function testDefaultLogger()
213213
\E_USER_DEPRECATED => [null, LogLevel::INFO],
214214
\E_NOTICE => [$logger, LogLevel::WARNING],
215215
\E_USER_NOTICE => [$logger, LogLevel::CRITICAL],
216-
\E_STRICT => [null, LogLevel::WARNING],
217216
\E_WARNING => [null, LogLevel::WARNING],
218217
\E_USER_WARNING => [null, LogLevel::WARNING],
219218
\E_COMPILE_WARNING => [null, LogLevel::WARNING],
@@ -225,6 +224,12 @@ public function testDefaultLogger()
225224
\E_ERROR => [null, LogLevel::CRITICAL],
226225
\E_CORE_ERROR => [null, LogLevel::CRITICAL],
227226
];
227+
228+
// BC layer for PHP < 8.4
229+
if (\defined('E_STRICT')) {
230+
$loggers[\E_STRICT] = [null, LogLevel::WARNING];
231+
}
232+
228233
$this->assertSame($loggers, $handler->setLoggers([]));
229234
} finally {
230235
restore_error_handler();
@@ -478,7 +483,6 @@ public function testBootstrappingLogger()
478483
\E_USER_DEPRECATED => [$bootLogger, LogLevel::INFO],
479484
\E_NOTICE => [$bootLogger, LogLevel::WARNING],
480485
\E_USER_NOTICE => [$bootLogger, LogLevel::WARNING],
481-
\E_STRICT => [$bootLogger, LogLevel::WARNING],
482486
\E_WARNING => [$bootLogger, LogLevel::WARNING],
483487
\E_USER_WARNING => [$bootLogger, LogLevel::WARNING],
484488
\E_COMPILE_WARNING => [$bootLogger, LogLevel::WARNING],
@@ -491,6 +495,11 @@ public function testBootstrappingLogger()
491495
\E_CORE_ERROR => [$bootLogger, LogLevel::CRITICAL],
492496
];
493497

498+
// BC layer for PHP < 8.4
499+
if (\defined('E_STRICT')) {
500+
$loggers[\E_STRICT] = [$bootLogger, LogLevel::WARNING];
501+
}
502+
494503
$this->assertSame($loggers, $handler->setLoggers([]));
495504

496505
$handler->handleError(\E_DEPRECATED, 'Foo message', __FILE__, 123, []);

src/Symfony/Component/VarDumper/Caster/DOMCaster.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
class DOMCaster
2424
{
2525
private const ERROR_CODES = [
26-
\DOM_PHP_ERR => 'DOM_PHP_ERR',
26+
0 => 'DOM_PHP_ERR',
2727
\DOM_INDEX_SIZE_ERR => 'DOM_INDEX_SIZE_ERR',
2828
\DOMSTRING_SIZE_ERR => 'DOMSTRING_SIZE_ERR',
2929
\DOM_HIERARCHY_REQUEST_ERR => 'DOM_HIERARCHY_REQUEST_ERR',
@@ -138,16 +138,16 @@ public static function castDocument(\DOMDocument $dom, array $a, Stub $stub, boo
138138
'doctype' => $dom->doctype,
139139
'implementation' => $dom->implementation,
140140
'documentElement' => new CutStub($dom->documentElement),
141-
'actualEncoding' => $dom->actualEncoding,
141+
'actualEncoding' => $dom->encoding,
142142
'encoding' => $dom->encoding,
143143
'xmlEncoding' => $dom->xmlEncoding,
144-
'standalone' => $dom->standalone,
144+
'standalone' => $dom->xmlStandalone,
145145
'xmlStandalone' => $dom->xmlStandalone,
146-
'version' => $dom->version,
146+
'version' => $dom->xmlVersion,
147147
'xmlVersion' => $dom->xmlVersion,
148148
'strictErrorChecking' => $dom->strictErrorChecking,
149149
'documentURI' => $dom->documentURI ? new LinkStub($dom->documentURI) : $dom->documentURI,
150-
'config' => $dom->config,
150+
'config' => null,
151151
'formatOutput' => $dom->formatOutput,
152152
'validateOnParse' => $dom->validateOnParse,
153153
'resolveExternals' => $dom->resolveExternals,
@@ -275,9 +275,9 @@ public static function castEntity(\DOMEntity $dom, array $a, Stub $stub, bool $i
275275
'publicId' => $dom->publicId,
276276
'systemId' => $dom->systemId,
277277
'notationName' => $dom->notationName,
278-
'actualEncoding' => $dom->actualEncoding,
279-
'encoding' => $dom->encoding,
280-
'version' => $dom->version,
278+
'actualEncoding' => null,
279+
'encoding' => null,
280+
'version' => null,
281281
];
282282

283283
return $a;

src/Symfony/Component/VarDumper/Caster/ExceptionCaster.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class ExceptionCaster
4141
\E_USER_ERROR => 'E_USER_ERROR',
4242
\E_USER_WARNING => 'E_USER_WARNING',
4343
\E_USER_NOTICE => 'E_USER_NOTICE',
44-
\E_STRICT => 'E_STRICT',
44+
2048 => 'E_STRICT',
4545
];
4646

4747
private static $framesCache = [];

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