Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.16.8 crash because of symfony/polyfill-mbstring #5324

Closed
shouze opened this issue Dec 7, 2020 · 19 comments · Fixed by #5332
Closed

2.16.8 crash because of symfony/polyfill-mbstring #5324

shouze opened this issue Dec 7, 2020 · 19 comments · Fixed by #5332

Comments

@shouze
Copy link

shouze commented Dec 7, 2020

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

@derrabus
Copy link
Contributor

derrabus commented Dec 7, 2020

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.

@SpacePossum SpacePossum added this to the 2.16.9 milestone Dec 7, 2020
@shouze
Copy link
Author

shouze commented Dec 7, 2020

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

@SpacePossum
Copy link
Contributor

(ping @keradus maybe for this evening)

@derrabus
Copy link
Contributor

derrabus commented Dec 7, 2020

Same problem with 2.17.0.

@keradus
Copy link
Member

keradus commented Dec 7, 2020

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

@derrabus
Copy link
Contributor

derrabus commented Dec 8, 2020

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.

@jderusse
Copy link
Contributor

jderusse commented Dec 8, 2020

#5332 fix this

@derrabus
Copy link
Contributor

derrabus commented Dec 8, 2020

I guess I was wrong. 😅 Thank you @jderusse!

@keradus
Copy link
Member

keradus commented Dec 8, 2020

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

@derrabus
Copy link
Contributor

derrabus commented Dec 8, 2020

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

@keradus keradus removed this from the 2.16.9 milestone Dec 8, 2020
@keradus
Copy link
Member

keradus commented Dec 8, 2020

(milestone removed to have milestones on PRs only)

@derrabus
Copy link
Contributor

derrabus commented Dec 8, 2020

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

@SpacePossum
Copy link
Contributor

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

@driesvints
Copy link

@derrabus
Copy link
Contributor

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

@driesvints
Copy link

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: algolia/algoliasearch-client-php#644 (although I've disabled PHP CS Fixer again on PHP 8 in order to continue with it)

@SpacePossum
Copy link
Contributor

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 #4702

@derrabus
Copy link
Contributor

@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.

@driesvints
Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants