Skip to content

Implemented php version check in autoload.php#8546

Merged
Seldaek merged 11 commits intocomposer:masterfrom
Toflar:feature/php-version-validation-in-autoload
Apr 21, 2020
Merged

Implemented php version check in autoload.php#8546
Seldaek merged 11 commits intocomposer:masterfrom
Toflar:feature/php-version-validation-in-autoload

Conversation

@Toflar
Copy link
Copy Markdown
Contributor

@Toflar Toflar commented Jan 22, 2020

Integrates composer/semver#75 in Composer.
Successfully tested on one of my projects. Ran composer update with PHP 7.4.1 and then tried to run the app with 7.3.13 which now doesn't work anymore (in my case, because the version of ocramius/proxy-manager in my composer.lock requires 7.4.*) :)

@Toflar Toflar force-pushed the feature/php-version-validation-in-autoload branch from df3121f to ca2531d Compare January 22, 2020 12:53
@naderman
Copy link
Copy Markdown
Member

Should we do this just for PHP or also all extensions?

@Toflar
Copy link
Copy Markdown
Contributor Author

Toflar commented Jan 22, 2020

From my experience, most devs tend to only require "ext-foobar": "*" so it would most likely end up in unbound comparisons anyway. And we'd have quite some files to include 😄

@naderman
Copy link
Copy Markdown
Member

@Toflar Well I'd compile the check into a single file anyway, no need for multiple files?

@naderman
Copy link
Copy Markdown
Member

But yeah for most extensions I guess we just check presence, then again any unbounded constraint can just be skipped for code generation anyway?

@Toflar
Copy link
Copy Markdown
Contributor Author

Toflar commented Jan 22, 2020

The code generation currently just generates return true; for unbound constraints. Of course compiling into one file would be possible but not really the way the semver PR is currently built.

Comment thread src/Composer/Autoload/AutoloadGenerator.php Outdated
@Seldaek Seldaek added this to the 1.10 milestone Jan 28, 2020
Comment thread src/Composer/Autoload/AutoloadGenerator.php Outdated
Comment thread composer.json Outdated
Comment thread src/Composer/Autoload/AutoloadGenerator.php Outdated
Comment thread src/Composer/Autoload/AutoloadGenerator.php
Comment thread src/Composer/Autoload/AutoloadGenerator.php Outdated
Comment thread tests/Composer/Test/Autoload/Fixtures/platform_check.php Outdated
Comment thread src/Composer/Autoload/AutoloadGenerator.php Outdated
Comment thread src/Composer/Autoload/AutoloadGenerator.php Outdated
Comment thread src/Composer/Autoload/AutoloadGenerator.php Outdated
@GromNaN
Copy link
Copy Markdown
Contributor

GromNaN commented Apr 20, 2020

Thank you for this useful feature. It is a breaking change that should be noted to UPGRADE-2.0.md

@Seldaek Seldaek merged commit e23710f into composer:master Apr 21, 2020
@Seldaek
Copy link
Copy Markdown
Member

Seldaek commented Apr 21, 2020

Thanks!

@GromNaN that's right it should be mentioned, I'll update UPGRADE/CHANGELOG sometime this week again with latest changes.

@Toflar Toflar deleted the feature/php-version-validation-in-autoload branch April 21, 2020 07:34
@it-can it-can mentioned this pull request Apr 21, 2020
@curzio-della-santa
Copy link
Copy Markdown

curzio-della-santa commented Apr 24, 2020

I didn't analyzed the code in detail, but I'm pretty sure this change does not takes care of the provided PHP-extensions, as is in the case of using alcaeus/mongo-php-adapter

We had a production issue on deploy, because we perform an autoloader optimization downloading the composer.phar from https://getcomposer.org/composer.phar that currently returns the 2.x dev branch (issue is already open #8831 )

@Seldaek
Copy link
Copy Markdown
Member

Seldaek commented Apr 24, 2020

@curzio-della-santa that's absolutely correct, I am coincidentally just working on handling this :) Will commit a fix soon.

Seldaek added a commit that referenced this pull request Apr 24, 2020
Ayesh added a commit to Ayesh/Composer-Min-Autoload that referenced this pull request May 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants