Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[ErrorHandler][VarDumper] Remove PHP 8.4 deprecations#57799

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
nicolas-grekas merged 1 commit intosymfony:5.4fromalexandre-daubois:deprecs-8.4
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletionssrc/Symfony/Component/ErrorHandler/ErrorHandler.php
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -55,7 +55,6 @@ class ErrorHandler
\E_USER_DEPRECATED => 'User Deprecated',
\E_NOTICE => 'Notice',
\E_USER_NOTICE => 'User Notice',
\E_STRICT => 'Runtime Notice',
\E_WARNING => 'Warning',
\E_USER_WARNING => 'User Warning',
\E_COMPILE_WARNING => 'Compile Warning',
Expand All@@ -73,7 +72,6 @@ class ErrorHandler
\E_USER_DEPRECATED => [null, LogLevel::INFO],
\E_NOTICE => [null, LogLevel::WARNING],
\E_USER_NOTICE => [null, LogLevel::WARNING],
\E_STRICT => [null, LogLevel::WARNING],
\E_WARNING => [null, LogLevel::WARNING],
\E_USER_WARNING => [null, LogLevel::WARNING],
\E_COMPILE_WARNING => [null, LogLevel::WARNING],
Expand DownExpand Up@@ -183,6 +181,11 @@ public static function call(callable $function, ...$arguments)

public function __construct(?BufferingLogger $bootstrappingLogger = null, bool $debug = false)
{
if (\PHP_VERSION_ID < 80400) {
$this->levels[\E_STRICT] = 'Runtime Notice';
$this->loggers[\E_STRICT] = [null, LogLevel::WARNING];
}

if ($bootstrappingLogger) {
$this->bootstrappingLogger = $bootstrappingLogger;
$this->setDefaultLogger($bootstrappingLogger);
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -213,7 +213,6 @@ public function testDefaultLogger()
\E_USER_DEPRECATED => [null, LogLevel::INFO],
\E_NOTICE => [$logger, LogLevel::WARNING],
\E_USER_NOTICE => [$logger, LogLevel::CRITICAL],
\E_STRICT => [null, LogLevel::WARNING],
\E_WARNING => [null, LogLevel::WARNING],
\E_USER_WARNING => [null, LogLevel::WARNING],
\E_COMPILE_WARNING => [null, LogLevel::WARNING],
Expand All@@ -225,6 +224,11 @@ public function testDefaultLogger()
\E_ERROR => [null, LogLevel::CRITICAL],
\E_CORE_ERROR => [null, LogLevel::CRITICAL],
];

if (\PHP_VERSION_ID < 80400) {
$loggers[\E_STRICT] = [null, LogLevel::WARNING];
}

$this->assertSame($loggers, $handler->setLoggers([]));
} finally {
restore_error_handler();
Expand DownExpand Up@@ -478,7 +482,6 @@ public function testBootstrappingLogger()
\E_USER_DEPRECATED => [$bootLogger, LogLevel::INFO],
\E_NOTICE => [$bootLogger, LogLevel::WARNING],
\E_USER_NOTICE => [$bootLogger, LogLevel::WARNING],
\E_STRICT => [$bootLogger, LogLevel::WARNING],
\E_WARNING => [$bootLogger, LogLevel::WARNING],
\E_USER_WARNING => [$bootLogger, LogLevel::WARNING],
\E_COMPILE_WARNING => [$bootLogger, LogLevel::WARNING],
Expand All@@ -491,6 +494,10 @@ public function testBootstrappingLogger()
\E_CORE_ERROR => [$bootLogger, LogLevel::CRITICAL],
];

if (\PHP_VERSION_ID < 80400) {
$loggers[\E_STRICT] = [$bootLogger, LogLevel::WARNING];
}

$this->assertSame($loggers, $handler->setLoggers([]));

$handler->handleError(\E_DEPRECATED, 'Foo message', __FILE__, 123, []);
Expand Down
9 changes: 1 addition & 8 deletionssrc/Symfony/Component/VarDumper/Caster/DOMCaster.php
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -23,7 +23,7 @@
class DOMCaster
{
private const ERROR_CODES = [
\DOM_PHP_ERR => 'DOM_PHP_ERR',
0 => 'DOM_PHP_ERR',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Do we need to keep this entry? The way I readthe RFC it will no longer be needed:

PRphp/php-src#11927 got rid of the last use of DOM_PHP_ERR in PHP. It is a non-standard and non-well-defined error code. The last use was for an out-of-memory situation but that's inconsistent as we normally use INVALID_STATE_ERR for that.

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

To me, yes. It's targeting 5.4, and we better be careful and just remove deprecation with the minimum possible updates, and without changing any behavior if possible.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Well, what I have in mind is adding this entry only in case the used PHP version is before 8.4 (or maybe when the constant is actually defined). Inlining the constant value makes it harder to identify them later when we want to clean up things.

Copy link
MemberAuthor

@alexandre-dauboisalexandre-dauboisJul 23, 2024
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Even with the plain string next to it? It is stored in a constant array and this will require a bit of extra logic everywhere the array constant is called. Still worth it to you?

\DOM_INDEX_SIZE_ERR => 'DOM_INDEX_SIZE_ERR',
\DOMSTRING_SIZE_ERR => 'DOMSTRING_SIZE_ERR',
\DOM_HIERARCHY_REQUEST_ERR => 'DOM_HIERARCHY_REQUEST_ERR',
Expand DownExpand Up@@ -138,16 +138,12 @@ public static function castDocument(\DOMDocument $dom, array $a, Stub $stub, boo
'doctype' => $dom->doctype,
'implementation' => $dom->implementation,
'documentElement' => new CutStub($dom->documentElement),
'actualEncoding' => $dom->actualEncoding,
'encoding' => $dom->encoding,
'xmlEncoding' => $dom->xmlEncoding,
'standalone' => $dom->standalone,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Where is this change coming from?

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

'xmlStandalone' => $dom->xmlStandalone,
'version' => $dom->version,
'xmlVersion' => $dom->xmlVersion,
'strictErrorChecking' => $dom->strictErrorChecking,
'documentURI' => $dom->documentURI ? new LinkStub($dom->documentURI) : $dom->documentURI,
'config' => $dom->config,
'formatOutput' => $dom->formatOutput,
'validateOnParse' => $dom->validateOnParse,
'resolveExternals' => $dom->resolveExternals,
Expand DownExpand Up@@ -275,9 +271,6 @@ public static function castEntity(\DOMEntity $dom, array $a, Stub $stub, bool $i
'publicId' => $dom->publicId,
'systemId' => $dom->systemId,
'notationName' => $dom->notationName,
'actualEncoding' => $dom->actualEncoding,
'encoding' => $dom->encoding,
'version' => $dom->version,
];

return $a;
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -41,7 +41,7 @@ class ExceptionCaster
\E_USER_ERROR => 'E_USER_ERROR',
\E_USER_WARNING => 'E_USER_WARNING',
\E_USER_NOTICE => 'E_USER_NOTICE',
\E_STRICT => 'E_STRICT',
2048 => 'E_STRICT',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

should be dependent on the presence of the constant IMO (that way we can more easily identify parts of the code to be cleaned up once support for older PHP versions is going to be dropped)

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I think there are few chances to forget it with the plain string next to it. Also, it is stored in a static property in a static class. It also requires extra logic wherever the static property is called, raising chances of introducing a bug if a new usage occurrence of the static property is introduced 😕

];

private static $framesCache = [];
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp