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

Documentation: add warning about Composer 2.3 #656

Closed
jrfnl opened this issue Apr 5, 2022 · 3 comments · Fixed by #674
Closed

Documentation: add warning about Composer 2.3 #656

jrfnl opened this issue Apr 5, 2022 · 3 comments · Fixed by #674

Comments

@jrfnl
Copy link
Contributor

jrfnl commented Apr 5, 2022

👋🏻 Hiya,

I'm not sure where to add this, but I believe it would be prudent to add a warning somewhere in the documentation about Composer 2.3.

Context

Composer 2.3 drops support for PHP 7.2 and the autoload files generated with Composer 2.3 are no longer compatible with PHP < 7.0.

The problem

A lot of projects which create PHAR files will include the composer autoload files in the PHAR and use them for the autoloading of the files within the PHAR.

If a project does so AND needs their PHAR to be runnable of PHP < 7.0, this will break if Composer 2.3 was used to prepare the files to be boxed up.

As Box itself has a minimum of PHP 7.4 and the PHAR file is often generated via a GH Actions workflow, this can be problematic as Composer 2.3 will be installed by default on PHP 7.2+.

The solution

The solution is quite straight-forward: make sure Composer 2.2 is used to prepare the files to be boxed up.

In GH Actions, this would typically be done like this (specifically the last two lines):

       - name: Setup PHP
         uses: shivammathur/setup-php@v2
         with:
           php-version: 8.0
           extensions: exif, phar, openssl
           ini-values: phar.readonly=Off, error_reporting=-1, display_errors=On, zend.assertions=1
           # Autoload files generated with Composer 2.3 are not compatible with PHP < 7.0.
           tools: composer:2.2
@theofidry
Copy link
Member

Hi @jrfnl!

Sorry for the very late reply, I could not check any GitHub related notification for a while.

Since it's Composer itself introducing this limitation, I am wondering if it's worth going against it, especially since the next release of Box will require 8.1. I'm also a bit torn regarding the requirement checker tool if it should really stay to 5.3 or can simply be bumped as well.

I however do like the idea of a warning at generation time that the PHAR minimum PHP version supported may not match the desired one.

theofidry added a commit that referenced this issue Jun 20, 2022
As Composer 2.3 is dropping PHP 5.3 and requires 7.2.5+ as the minimum PHP version, so does Box.

In theory it would be possible to keep the 5.3 compatibility, but that would require non trivial efforts as it would require to make the bundle requirement checker work without Composer autoloading _and_ keeping track of Composer Semver too.

Since 7.2.5 is now the minimum, the requirement checker has been pimped up a bit.

Closes #656
@jrfnl
Copy link
Contributor Author

jrfnl commented Jun 21, 2022

@theofidry Sorry to hear you'll be dropping support for older PHP versions, but I respect your decision. I'll keep an eye on the releases to make sure projects I'm involved with, which still support PHP < 7.2, will remain on an older version of Box.

@theofidry
Copy link
Member

I'm not too happy about it either to be honest.

The main reason is just the amount of work. At the moment the way the requirement checker is built is relying on Composer (and there is the scoping process afterwards as well). But if the dumped scoped requirement checker .requirement-checker does not depend on the Composer autoloader, it would be trivial (from that point) to add back support for down to PHP 5.3.

Getting there though is a significant amount of work and I'm not 100% sure on how to do this neither.

jrfnl added a commit to jrfnl/php-coveralls that referenced this issue Sep 12, 2022
Box 2 is no longer maintained and will not be made compatible with more recent PHP versions.

#### Config

* Updated the Box configuration for changes made in Box 3 and 4.
* Removed the `*.php8` and `*.pem` extensions from the finder config as those are not used in this project.
* Explicitly set `check-requirements` to `false` as the requirements checker in Box 4 is not compatible with PHP < 7.2.

#### GH Actions workflows

* Updated the PHP setup to have the necessary PHP version, extensions and ini config needed to generate the PHAR.
* Explicitly set the required Composer version to `2.2` as the autoload files generated with Composer 2.3+ are not compatible with PHP 5.5.
* Updated the PHAR generation command.
* Added validation and debug steps for the PHAR generation.
* Added a step to upload the Phar as a build artifact.
    The PHAR files uploaded in this way will remain accessible for 60 days.
* Added a job to test that the Phar is minimally functional against the high/middle/low supported PHP versions.

Refs:
* https://github.com/box-project/box/blob/master/UPGRADE.md
* https://github.com/box-project/box/blob/master/doc/configuration.md
* https://github.com/box-project/box/blob/master/doc/requirement-checker.md#requirements-checker
* box-project/box#656 (comment)
jrfnl added a commit to jrfnl/php-coveralls that referenced this issue Sep 12, 2022
Box 2 is no longer maintained and will not be made compatible with more recent PHP versions.

#### Config

* Updated the Box configuration for changes made in Box 3 and 4.
* Explicitly set `check-requirements` to `false` as the requirements checker in Box 4 is not compatible with PHP < 7.2.

#### GH Actions workflows

* Updated the PHP setup to have the necessary PHP version, extensions and ini config needed to generate the PHAR.
* Explicitly set the required Composer version to `2.2` as the autoload files generated with Composer 2.3+ are not compatible with PHP 5.5.
* Updated the PHAR generation command.
* Added validation and debug steps for the PHAR generation.
* Added a step to upload the Phar as a build artifact.
    The PHAR files uploaded in this way will remain accessible for 60 days.
* Added a job to test that the Phar is minimally functional against the high/middle/low supported PHP versions.

Refs:
* https://github.com/box-project/box/blob/master/UPGRADE.md
* https://github.com/box-project/box/blob/master/doc/configuration.md
* https://github.com/box-project/box/blob/master/doc/requirement-checker.md#requirements-checker
* box-project/box#656 (comment)
jrfnl added a commit to jrfnl/php-coveralls that referenced this issue Sep 12, 2022
Box 2 is no longer maintained and will not be made compatible with more recent PHP versions.

#### Config

* Updated the Box configuration for changes made in Box 3 and 4.
* Explicitly set `check-requirements` to `false` as the requirements checker in Box 4 is not compatible with PHP < 7.2.

#### GH Actions workflows

* Install the dependencies on the minimum supported PHP version.
* Updated the PHP setup to have the necessary PHP version, extensions and ini config needed to generate the PHAR with Box 4.
* Explicitly set the required Composer version to `2.2` as the autoload files generated with Composer 2.3+ are not compatible with PHP 5.5.
* Updated the PHAR generation command.
* Added validation and debug steps for the PHAR generation.
* Added a step to upload the Phar as a build artifact.
    The PHAR files uploaded in this way will remain accessible for 60 days.
* Added a job to test that the Phar is minimally functional against the high/middle/low supported PHP versions.

Refs:
* https://github.com/box-project/box/blob/master/UPGRADE.md
* https://github.com/box-project/box/blob/master/doc/configuration.md
* https://github.com/box-project/box/blob/master/doc/requirement-checker.md#requirements-checker
* box-project/box#656 (comment)
keradus pushed a commit to php-coveralls/php-coveralls that referenced this issue Sep 14, 2022
* Upgrade PHAR generation to Box 4.x

Box 2 is no longer maintained and will not be made compatible with more recent PHP versions.

#### Config

* Updated the Box configuration for changes made in Box 3 and 4.
* Explicitly set `check-requirements` to `false` as the requirements checker in Box 4 is not compatible with PHP < 7.2.

#### GH Actions workflows

* Install the dependencies on the minimum supported PHP version.
* Updated the PHP setup to have the necessary PHP version, extensions and ini config needed to generate the PHAR with Box 4.
* Explicitly set the required Composer version to `2.2` as the autoload files generated with Composer 2.3+ are not compatible with PHP 5.5.
* Updated the PHAR generation command.
* Added validation and debug steps for the PHAR generation.
* Added a step to upload the Phar as a build artifact.
    The PHAR files uploaded in this way will remain accessible for 60 days.
* Added a job to test that the Phar is minimally functional against the high/middle/low supported PHP versions.

Refs:
* https://github.com/box-project/box/blob/master/UPGRADE.md
* https://github.com/box-project/box/blob/master/doc/configuration.md
* https://github.com/box-project/box/blob/master/doc/requirement-checker.md#requirements-checker
* box-project/box#656 (comment)

* GH Actions: PHAR generation tweaks

... after PR review.

Co-authored-by: jrfnl <jrfnl@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants