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

unnecessary error message when ignoring the upper bound of platform requirements #11722

Closed
dg opened this issue Nov 21, 2023 · 3 comments · Fixed by #11786
Closed

unnecessary error message when ignoring the upper bound of platform requirements #11722

dg opened this issue Nov 21, 2023 · 3 comments · Fixed by #11786
Labels
Milestone

Comments

@dg
Copy link
Contributor

dg commented Nov 21, 2023

When option --ignore-platform-req=php+ is used, it still prints the error message like Cannot use texy/texy's latest version v3.2.0 as it requires php 8.1 - 8.3 which is not satisfied by your platform., although it does install the library.

composer.json:

{
    "config": {
        "platform": {
            "php": "8.4"
        }
    }
}

Run:

composer --ignore-platform-req=php+ require texy/texy
@fredden
Copy link
Contributor

fredden commented Dec 5, 2023

I've tested this locally with Composer version 2.6.5 and PHP 8.2.

Command Warning shown? Version installed
composer require texy/texy Yes 3.1.7
composer --ignore-platform-req=php require texy/texy No 3.2.0
composer --ignore-platform-req=php+ require texy/texy Yes 3.2.0

According to the documentation for --ignore-platform-req, using php+ changes the restraint from =8.4 to >=8.4. Version 3.2.0 of the texy/texy package requires PHP versions 8.1-8.3, which is not satisfiable with a constraint of >=8.4. Printing the warning here seems sensible to me.

I think the bug here is not about the warning message, but instead that when specifying php+ we get an "incorrect" version of the package installed. I would expect version 3.1.7 to be installed (which has a PHP constraint of >=7.1), not version 3.2.0 (which has a PHP constraint of 8.1-8.3).

@dg
Copy link
Contributor Author

dg commented Dec 5, 2023

@fredden --ignore-platform-req does not affect the value in config > platform, but the value in require > php in the installed package. So it doesn't affect 8.4, but the value of 8.1 - 8.3 here https://github.com/dg/texy/blob/master/composer.json#L14

@Seldaek
Copy link
Member

Seldaek commented Jan 4, 2024

Yeah I see what you mean, the first line of output there is not needed, and actually incorrect as it ends up using it anyway. I'll see if we can get rid of that.

$ composer --ignore-platform-req=php+ require texy/texy
Cannot use texy/texy's latest version v3.2.0 as it requires php 8.1 - 8.3 which is not satisfied by your platform.
./composer.json has been updated
Running composer update texy/texy
Loading composer repositories with package information
Updating dependencies
Lock file operations: 1 install, 0 updates, 0 removals
  - Locking texy/texy (v3.2.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Downloading texy/texy (v3.2.0)
  - Installing texy/texy (v3.2.0): Extracting archive
Generating autoload files
No security vulnerability advisories found.
Using version ^3.2 for texy/texy

@Seldaek Seldaek added this to the 2.6 milestone Jan 4, 2024
@Seldaek Seldaek added the Bug label Jan 4, 2024
@Seldaek Seldaek modified the milestones: 2.6, 2.7 Jan 8, 2024
Seldaek added a commit to Seldaek/composer that referenced this issue Jan 8, 2024
Seldaek added a commit that referenced this issue Jan 8, 2024
theoboldalex pushed a commit to theoboldalex/composer that referenced this issue Jan 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants
@Seldaek @dg @fredden and others