PHP-CS-Fixer: 2.16.8 crash because of symfony/polyfill-mbstring

Bug report

I’m using php 8.0.0 with mbstring extension loaded. I know php8 is not fully supported at the moment but it works pretty well with previous cs-fixer release and env var PHP_CS_FIXER_IGNORE_ENV=1.

PHP needs to be a minimum version of PHP 5.6.0 and maximum version of PHP 7.4.*.
Ignoring environment requirements because `PHP_CS_FIXER_IGNORE_ENV` is set. Execution may be unstable.
PHP Fatal error:  Uncaught ErrorException: require_once(phar:///tmp/php-cs-fixer/vendor/symfony/polyfill-mbstring/Resources/mb_convert_variables.php8): Failed to open stream: phar error: "vendor/symfony/polyfill-mbstring/Resources/mb_convert_variables.php8" is not a file in phar "/tmp/php-cs-fixer" in phar:///tmp/php-cs-fixer/vendor/symfony/polyfill-mbstring/bootstrap.php:115
Stack trace:
#0 phar:///tmp/php-cs-fixer/vendor/symfony/polyfill-mbstring/bootstrap.php(115): {closure}()
#1 phar:///tmp/php-cs-fixer/vendor/symfony/polyfill-mbstring/bootstrap.php(115): require_once()
#2 phar:///tmp/php-cs-fixer/vendor/composer/autoload_real.php(71): require('...')
#3 phar:///tmp/php-cs-fixer/vendor/composer/autoload_real.php(61): composerRequire9f0dd14c94ce02dc34a0e91e293e3b6e()
#4 phar:///tmp/php-cs-fixer/vendor/autoload.php(7): ComposerAutoloaderInit9f0dd14c94ce02dc34a0e91e293e3b6e::getLoader()
#5 /tmp/php-cs-fixer(61): require_once('...')
#6 {main}

Next Error: Failed opening required 'phar:///tmp/php-cs-fixer/vendor/symfony/polyfill-mbstring/Resources/mb_convert_variables.php8' (include_path='.:/opt/bref/lib/php') in phar:///tmp/php-cs-fixer/vendor/symfony/polyfill-mbstring/bootstrap.php:115
Stack trace:
#0 phar:///tmp/php-cs-fixer/vendor/composer/autoload_real.php(71): require()
#1 phar:///tmp/php-cs-fixer/vendor/composer/autoload_real.php(61): composerRequire9f0dd14c94ce02dc34a0e91e293e3b6e()
#2 phar:///tmp/php-cs-fixer/vendor/autoload.php(7): ComposerAutoloaderInit9f0dd14c94ce02dc34a0e91e293e3b6e::getLoader()
#3 /tmp/php-cs-fixer(61): require_once('...')
#4 {main}
  thrown in phar:///tmp/php-cs-fixer/vendor/symfony/polyfill-mbstring/bootstrap.php on line 115

Code snippet that reproduces the problem

Just run ph-cs-fixer --version for example

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 19 (15 by maintainers)

Most upvoted comments

Ah sorry everyone. Someone on the PR made the false assumption that PHP 8 is now supported on PHP CS Fixer which I didn’t verify myself. My bad!

Hi @driesvints , The issue in your sample is running the tool on PHP8 which is not officially supported yet, it is not related to the issue discussed here. For more info on the process on PHP8 support and how to help out please check out https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues/4702

I can confirm that the 2.17.1 PHAR works flawlessly on PHP 8. Thank you very much for the quick fix! ❤️

(milestone removed to have milestones on PRs only)

I’ll try to find some time tonight. I’m pretty sure though that this has to be fixed not in this repository but in the polyfill’s.

This seems to be an issue with the PHAR distribution of PHP CS Fixer 2.16.8. The PHAR of 2.16.7 works fine and if I install 2.16.8 via composer as a dependency of my project, ./vendor/bin/php-cs-fixer also works fine.