-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Q | A |
---|---|
PHPUnit version | 9.6.20, but the 8.5 branch seems to be affected too. |
PHP version | 8.4-dev |
Installation Method | Composer |
Summary
PHP 8.4 triggers a deprecation if we access the E_STRICT
constant.
That error code is obsolete since PHP 7.0, but some core extensions did still use it in rare cases until PHP 7.4. The deprecation prepares a possible future removal of said constant.
The constant is used inside a switch
block that triggers different behavior depending on the error level. This means that even if no E_STRICT
errors are triggered, we get a deprecation notice because PHPUnit accesses a deprecated constant for comparison.
I'd volunteer to work on a fix, but I'm not sure about the way forward. Not handling the E_STRICT
level at all feels wrong because as long as the level exists, some custom PHP extension could still trigger it. We could just use the plain value of the constant for comparison, assuming that the constant's value will never be changed or repurposed in future PHP releases.
Current behavior
PHP Deprecated: Constant E_STRICT is deprecated in /path/to/phpunit/src/Util/ErrorHandler.php on line 99
How to reproduce
Run a test that triggers PHPUnit's error handler.
Expected behavior
No deprecation is triggered.