🔥 Hot fix: Fix PHAR not being compatible with PHP < 7.0 / Composer 2.3 #116
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 thesetup-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 the1.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 fordevelop
).