Php-cs-fixer: 2.16.8 crash because of symfony/polyfill-mbstring

Created on 7 Dec 2020  路  19Comments  路  Source: FriendsOfPHP/PHP-CS-Fixer

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

kinbug topirelease

All 19 comments

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.

@derrabus yes this is what I suspected... packaging issue.

(ping @keradus maybe for this evening)

Same problem with 2.17.0.

thanks for the report. would you like to raise a PR fixing the issue, @shouze / @derrabus ?

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.

I guess I was wrong. 馃槄 Thank you @jderusse!

actually the issue came due to changes in polyfills :( https://github.com/symfony/polyfill/pull/287/files

Yes. The name of that new file was probably a bit unexpected.

(milestone removed to have milestones on PRs only)

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

thanks for reporting back, great to hear it works :D

Your link takes me to a login page, @driesvints. 馃槩

Sorry about that. Here's the screenshots of the build:

Screenshot 2020-12-10 at 15 09 07

Screenshot 2020-12-10 at 15 09 30

It's for the following PR: https://github.com/algolia/algoliasearch-client-php/pull/644 (although I've disabled PHP CS Fixer again on PHP 8 in order to continue with it)

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

@driesvints That's a different issue. Running PHP CS Fixer on PHP 8 is considered experimental, so you still need to set an environment variable PHP_CS_FIXER_IGNORE_ENV=true to acknowledge that circumstance.

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!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

carusogabriel picture carusogabriel  路  3Comments

Bilge picture Bilge  路  3Comments

aidantwoods picture aidantwoods  路  3Comments

vitek-rostislav picture vitek-rostislav  路  3Comments

fisharebest picture fisharebest  路  3Comments