-
Notifications
You must be signed in to change notification settings - Fork 4
PHP 8.4: E_STRICT constant deprecated #17
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
PHPUnit/Framework/TestResult.php
Outdated
| $errorLevels = E_ALL | E_STRICT; | ||
| if (PHP_VERSION_ID >= 70400) { | ||
| $errorLevels = E_ALL; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it'd be safer to reverse the condition, and use E_STRICT only inside a condition block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@falkenhawk True, thank you!
Edit: done!
|
|
||
| if ($errno == E_NOTICE || $errno == E_USER_NOTICE || $errno == E_STRICT) { | ||
| if ($errno == E_NOTICE || $errno == E_USER_NOTICE | ||
| || (PHP_VERSION_ID < 70400 && $errno == E_STRICT)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| || (PHP_VERSION_ID < 70400 && $errno == E_STRICT)) { | |
| || (PHP_VERSION_ID < 80400 && $errno == E_STRICT)) { |
Shouldn't the deprecation start with 8.4? not 7.4?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@glensc According to this, some functions already emit deprecation notice starting 7.4:
https://php.watch/versions/8.4/E_STRICT-deprecated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from the linked article:
It is safe to assume that any PHP applications that run on PHP 8.0 and later will never encounter E_STRICT notices
but still the correct check would be <= 70400 or < 80000 instead of < 70400 @marcing
| $errorLevels = E_ALL; | ||
| if (PHP_VERSION_ID < 70400) { | ||
| $errorLevels = E_ALL | E_STRICT; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alternatives:
single line:
$errorLevels = PHP_VERSION_ID < 70400 ? E_ALL | E_STRICT : E_ALL;`multiline:
$errorLevels = E_ALL;
if (PHP_VERSION_ID < 70400) {
$errorLevels |= E_STRICT;
}There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the current one is clear enough and easy to understand.
PHP 8.4: E_STRICT constant deprecated
https://php.watch/versions/8.4/E_STRICT-deprecated