-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Composer 2.2: selective update breaks on changed requirement #10394
Copy link
Copy link
Closed
Description
Summary
There's a change in behaviour between Composer 2.1 and 2.2, where dependencies which were previously resolved without problem, now no longer get resolved.
Basic premise is a repo which has a committed composer.lock file and uses on-the-fly updates in the CI runs via GH Actions.
These updates used to work fine, but are now broken and failing builds.
I've set up a reproduction sample here: https://github.com/jrfnl/composer-2.2-bug-poc
And the changed behaviour and full -vvv output can be seen in the GH Actions output: https://github.com/jrfnl/composer-2.2-bug-poc/actions/runs/1616471281
My composer.json:
{
"name": "jrfnl/composer-2.2-bug-poc",
"description": "Proof of concept",
"license": "GPL-2.0-or-later",
"require": {
"php": ">=5.6"
},
"require-dev": {
"yoast/wp-test-utils": "^1.0.0"
},
"config": {
"platform": {
"php": "5.6.40"
}
}
}When I run this command on PHP 8.0:
composer require --dev phpunit/phpunit:"^7.5" --no-update --ignore-platform-req=php
composer update yoast/wp-test-utils --with-dependencies --ignore-platform-req=php
I get the following output:
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- phpunit/phpunit[7.5.0, ..., 7.5.20] require sebastian/exporter ^3.1 -> found sebastian/exporter[3.1.0, ..., 3.1.4] but these were not loaded, likely because it conflicts with another require.
- Root composer.json requires phpunit/phpunit ^7.5 -> satisfiable by phpunit/phpunit[7.5.0, ..., 7.5.20].
Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
And I expected this to happen:
The update to succeed without problems.
Other notes:
Additional things I've tried:
--with-dependenciesvs--with-all-dependenciesdoes not make a difference.- Specifying the versions in the
updatecommand didn't help. - Using
--with ...in the update command doesn't help. - Using
--no-installinstead of--no-updatein the first command doesn't help.
Work-around which works
... but may not play nice with caching in GH Actions as much:
composer remove --dev yoast/wp-test-utils
composer require --dev yoast/wp-test-utils:"^1.0.0" phpunit/phpunit:"^7.5" --update-with-dependencies --ignore-platform-reqs
Reactions are currently unavailable