-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
PHP-Scoper 0.18.12 breaks PHAR for PHPUnit 8.5 on PHP 7.2 #5855
PHP-Scoper 0.18.12 breaks PHAR for PHPUnit 8.5 on PHP 7.2 #5855
Comments
@theofidry Before I dig into this, is there anything that would be obvious to you that might explain this? Thanks! |
Maybe this from the release https://github.com/humbug/php-scoper/releases/tag/0.18.12
https://github.com/nikic/PHP-Parser?tab=readme-ov-file#php-parser says:
So you can't run this on PHP < 7.4 I guess? 🤔 |
@mfn PHP-Scoper requires a newer version of PHP, yes. But that does not have to mean that the modified code no longer works with PHP 7.2. |
Aside from the PHP-Parser upgrade I don't see anything that could cause this :/ Do you have the offending code by any chance? I can take a look at it |
Attached is the result of |
Ok I got a small reproducer within the PHP-Scoper test suite, will look more into it |
This PR introduces a `php-version` to the configuration file and as command options for the `add-prefix` and `inspect` command (e.g. have `--php-version=7.2`). The PHP version provided is used to configure the underlying PHP-Parser Parser and Printer. This will not affect the PHP internal symbols used by PHP-Scoper (i.e. `mb_str_pad` will be understood as an internal function, even if the PHP version configured is <8.3). However, this will affect what code can be parsed and how the code will be printed. If no PHP version is used, the host version will be used, i.e. executing it with PHP 8.4 will result in PHP 8.4 being used as the PHP version. This should allow to forcefully fix sebastianbergmann/phpunit#5855.
See the discussion in nikic/PHP-Parser#1007. This should fix sebastianbergmann/phpunit#5855 although this may result in more ugly code formatting than desired. For this reason the default printer version is 7.2 rather than 5.3 as it would make the code too otherwise.
@sebastianbergmann this should be fixed in 0.18.14. If it is not, for this specific build, you can use |
Thank you! |
After updating PHP-Scoper from 0.18.11 to 0.18.12 in a3d40a3, the PHAR for PHPUnit 8.5 does not work with PHP 7.2:
The text was updated successfully, but these errors were encountered: