Skip to content
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

PHP 8.4: E_STRICT constant deprecated #125

Merged
merged 2 commits into from
Jan 17, 2025

Conversation

ziegenberg
Copy link
Contributor

From PHP 8.4 the E_STRICT constant has been deprecated and will emit deprecation notices.

PHP core and core extensions since PHP 8.0 and later do not emit E_STRICT notices at all. It is safe to assume that any PHP applications that run on PHP 8.0 and later will never encounter E_STRICT notices, and error reporting and handling can be safely updated to ignore E_STRICT notices.

For details see: https://php.watch/versions/8.4/E_STRICT-deprecated

@ziegenberg
Copy link
Contributor Author

This is related to this topic: https://tracker.moodle.org/browse/MDL-83334

@gggeek
Copy link
Owner

gggeek commented Jan 17, 2025

This looks good, but tbh I'd prefer a check with uses PHP_VERSION rather than PHP_VERSION_ID - it is just easier on the brain :-) (and I dont think that this check is in a critical path wrt. perfs, so an extra call to version_compare is acceptable).
Or maybe add a one-line comment just above, mentioning php 8.4 ?

@ziegenberg
Copy link
Contributor Author

I will add a comment.

What about the following line?

//if ($errCode != E_NOTICE && $errCode != E_WARNING && $errCode != E_USER_NOTICE && $errCode != E_USER_WARNING)

Do we need this? Can this go? I did not find any information on its history.

From PHP 8.4 the E_STRICT constant has been deprecated and will emit
deprecation notices. PHP core and core extensions since PHP 8.0 and
later do not emit E_STRICT notices at all. On PHP 7 series before PHP
7.4, some functions conditionally emit E_STRICT notices.

For details see: https://php.watch/versions/8.4/E_STRICT-deprecated

Signed-off-by: Daniel Ziegenberg <[email protected]>
@ziegenberg ziegenberg force-pushed the e-strict-deprecation branch from 4752a0a to ba1220f Compare January 17, 2025 15:46
@ziegenberg
Copy link
Contributor Author

I removed the additional but unused conditional in an extra commit. You may drop it or keep it as you see fit. I also amended the commit message providing a bit more information.

@gggeek gggeek merged commit d4814b5 into gggeek:master Jan 17, 2025
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants