Problem/Motivation
If you start a Drupal 8.9.0-beta2 project with Composer like this:
$ composer create-project drupal/recommended-project:8.9.0-beta2 upgradetest
$ cd upgradetest/... you can update with this command:
$ composer update drupal/core-recommended --with-dependencies
[..]
- Updating drupal/core (8.9.0-beta2 => 8.9.2): Downloading (100%)
- Updating drupal/core-recommended (8.9.0-beta2 => 8.9.2)However, with Drush installed, it downgrades to 8.8.8:
$ composer require drush/drush
Using version ^10.3 for drush/drush
$ composer update drupal/core-recommended --with-dependencies
Dependency "composer/installers" is also a root requirement, but is not explicitly whitelisted. Ignoring.
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 2 installs, 3 updates, 2 removals
- Removing laminas/laminas-feed (2.12.0)
- Removing laminas/laminas-diactoros (1.8.7)
- Updating laminas/laminas-zendframework-bridge (1.0.1 => 1.0.4): Loading from cache
- Installing zendframework/zend-feed (2.12.0): Downloading (100%)
- Installing zendframework/zend-diactoros (1.8.7): Downloading (100%)
- Downgrading drupal/core (8.9.0-beta2 => 8.8.8): Downloading (100%)
- Downgrading drupal/core-recommended (8.9.0-beta2 => 8.8.8)
$
Original report by @hansfn
| Comment | File | Size | Author |
|---|---|---|---|
| composer-update-890beta-892.txt | 33.69 KB | ressa |
Comments
Comment #2
ressaComment #3
jcnventuraThis works however:
composer update drupal/core-recommended symfony/* --with-all-dependenciesSeems to be some interference between the symfony libraries used by drush and the ones locked down by drupal/core-recommended. It's probably not a good idea to only update drupal/core-recommended without updating the rest (or at least symfony/*), unless the site is a drupal core test. In this case, and at this time, I saw that symfony/polyfill-php72 had to be downgraded from 1.18 to 1.17 to allow the installation of core 8.9.2.
Comment #4
hansfn commentedAnd next time it's some non-Symfony package causing the problem ... I just love Composer.
We need to be able to recommend one command that always works and don't upgrade too much (potentially breaking the site). ressa and I wonder if simply
is "safe" when you using core-recommended (which you get when starting with recommended-project).
Comment #5
jcnventuraYes.
composer updateshould be safe, you'll get the version locks provided by core-recommended, and also allow all packages to adjust to them.Comment #6
ressaThanks for weighing in @jcnventura, and yes I agree with @hansfn that we should strive to recommend the shortest possible command, to keep it simple. But won't
composer updatealso update any modules with updates? Of course, unless they are pinned with~2.0or^1.2incomposer.json.@greg.1.anderson mentions testing Drush beforehand in #38 in #3159647: Add drush/drush to Drupal Composer project templates which would at least take care of Drush.
Comment #7
jcnventura@ressa, ~ or ^ won't lock your module versios. Only their absence will pin them.. And yes, composer update updates everything.
The issue here was that drush was depending on a package (symfony/polyfill-php72) that was not part of core-recommended upto 8.9.0-beta3. There are probably a few other drush dependencies that are not core dependencies.
The steps above added the latest version of this polyfill to the install, and the subsequent composer update of core-recommended would not complete to later than 8.9.0-beta2 because of this conflict. This does have the potential to happen with any drush dependency that is not shared with core. In this case, updating also all the symfony/* packages fixed it, but it could be one of the other dependencies in the future.
Comment #8
ressaSorry @jcnventura, you are correct, I meant limited in their "span of possible updates", as opposed to pinning it down with
"drupal/admin_toolbar": "2.0.0". Thanks for clarifying, and confirming thatcomposer updatewould also update any modules with updates, except if pinned.Comment #9
jcnventuraClosing this, as there's not much to be done here (at least not without a DeLorean with a flux capacitor), since:
Obviously any dependency of drush that is not already a dependency of drupal/core-recommended has the potencial to create this same problem in the future. The solution would be to either prevent the use of extra packages by drush, or that drupal/core-recommended not add any new dependencies. None of these are acceptable, so just have to live with it.