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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃敟 Hot fix: Fix PHAR not being compatible with PHP < 7.0 / Composer 2.3 #116

Merged
merged 1 commit into from Apr 5, 2022

Conversation

jrfnl
Copy link
Collaborator

@jrfnl jrfnl commented Apr 5, 2022

During builds, the PHAR file is generated and uploaded as an artefact to be used during the test job.
Along the same lines, the PHAR file is generated via a GH Actions workflow when a new version has been tagged and uploaded to the "Release".

Composer 2.3 has been released last week, which has a minimum PHP version of PHP 7.2 and the autoload files generated with Composer 2.3 are no longer compatible with PHP < 7.0.

Composer 2.2 (with a minimum PHP version of PHP 5.3) is now a LTS (long term service) release and will receive essential bug fixes.

The setup-php action runner will automatically install the appropriate version of Composer depending on the PHP version requested - Composer 2.2 for PHP < 7.2 and Composer 2.3+ for PHP 7.2+.

For the PHAR file, which is being generated on PHP 8.0 in the workflows, this means that Composer 2.3 is being installed and used to generate the PHAR file, which means that the autoload files generated with Composer 2.3 will be included, which makes the PHAR incompatible with PHP < 7.0.

To fix this, I'm adding a tools key to the setup-php action runner for the PHAR generation workflow which explicitly demands Composer 2.2.x, ensuring that the autoload files which will be included in the PHAR file will be compatible with PHP < 7.0.

Refs:


Note: I'm pulling this PR to master to ensure the PHARs for the 1.x branch will be PHP cross-version compatible.

This commit should be cherry-picked to the develop branch (or I could open a separate PR for develop).

During builds, the PHAR file is generated and uploaded as an artefact to be used during the test job.
Along the same lines, the PHAR file is generated via a GH Actions workflow when a new version has been tagged and uploaded to the "Release".

Composer 2.3 has been released last week, which has a minimum PHP version of PHP 7.2 and the autoload files generated with Composer 2.3 are no longer compatible with PHP < 7.0.

Composer 2.2 (with a minimum PHP version of PHP 5.3) is now a LTS (long term service) release and will receive essential bug fixes.

The `setup-php` action runner will automatically install the appropriate version of Composer depending on the PHP version requested - Composer 2.2 for PHP < 7.2 and Composer 2.3+ for PHP 7.2+.

For the PHAR file, which is being generated on PHP 8.0 in the workflows, this means that Composer 2.3 is being installed and used to generate the PHAR file, which means that the autoload files generated with Composer 2.3 will be included, which makes the PHAR incompatible with PHP < 7.0.

To fix this, I'm adding a `tools` key to the `setup-php` action runner for the PHAR generation workflow which explicitly demands Composer 2.2.x, ensuring that the autoload files which will be included in the PHAR file will be compatible with PHP < 7.0.

Refs:
* https://blog.packagist.com/composer-2-3/
* https://github.com/composer/composer/releases
@grogy grogy merged commit 36ab8b4 into master Apr 5, 2022
@grogy grogy deleted the feature/fix-phar-building-composer-2.3 branch April 5, 2022 12:44
@grogy
Copy link
Member

grogy commented Apr 5, 2022

Thank you for fast fix. Could you open MR for develop branch?

@jrfnl
Copy link
Collaborator Author

jrfnl commented Apr 5, 2022

Done, see #120

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

Successfully merging this pull request may close these issues.

None yet

2 participants