You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PHP 8.0 compatibility: bug fix - ignore annotations are broken
A very recent change in PHP 8.0 changes the possible return values of the `substr()` function from:
> Pre-PHP 8:
> Returns the extracted part of string; or FALSE on failure, or an empty string.
> PHP 8-RC1:
> Returns the extracted part of string; or an empty string.
This is an insidious change as basically all code (strict) checking the return value of `substr()` against `false` will now be broken.
Checking the return value with `empty()` will fix this in a cross-version compatible manner as it allows for both `false` as well as an empty string being returned.
This change broke the ignore annotations as implemented in PHPCS.
The existing unit tests for the ignore annotations cover this change.
Includes removing some unnecessary, duplicate function calls to `substr()`.
Ref: php/php-src#6182
0 commit comments