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
PHPWarning: substr_compare(): The start position cannot exceed initial string length in /var/www/symfony/vendor/symplify/easy-coding-standard/vendor/friendsofphp/php-cs-fixer/src/AbstractPhpdocTypesFixer.php on line 105
Some empty strings are passed to the normalizeType() method so \substr_compare($type, '[]', -\strlen('[]')) produces warnings.
The text was updated successfully, but these errors were encountered:
…ack (SpacePossum)
This PR was squashed before being merged into the 1.23-dev branch.
Discussion
----------
[Php80] Fix str_ends_with() when needle is longer than haystack
Little bug, found in PHP-CS-Fixer/PHP-CS-Fixer#6323https://3v4l.org/oHUKH
```php
<?php
error_reporting(E_ALL);
$needle = '[]';
echo \substr_compare('', $needle, -\strlen($needle));
```
show issues for
```
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.17, 7.3.0 - 7.3.4
Warning: substr_compare(): The start position cannot exceed initial string length in /in/oHUKH on line 4
```
Looking at the test matrix I assume the tests will run latest 7.2 which is not effected,
~so I naively changed it here in this draft to see if my test indeeds fails on the CI (I don't have an easy 7.2.17 or 7.1.0 env. at hand at the moment)~ @ see shivammathur/setup-php#570
Commits
-------
09a94a5 [Php80] Fix str_ends_with() when needle is longer than haystack
Hi, this problem came up when using ECS but refers to php-cs-fixer so I report here.
PHP version: 7.2
php-cs-fixer version: 3.6.0 (checked via PHP_CS_FIXER_IGNORE_ENV=-1 php vendor/symplify/easy-coding-standard/vendor/bin/php-cs-fixer -v)
Some empty strings are passed to the
normalizeType()
method so\substr_compare($type, '[]', -\strlen('[]'))
produces warnings.The text was updated successfully, but these errors were encountered: