Change record status: 
Project: 
Introduced in branch: 
9.1.x
Introduced in version: 
9.1.0-beta1
Description: 

For PHP 8 compatibility, Drupal core is now using composer/semver version 3, and automated tests are now using composer/composer version 2 internally. Note that this does not mean Composer 2 is required for site owners. It will still be possible to use either Composer version 1 (deprecated) or Composer version 2 (recommended) on the command line to manage a Drupal site for versions 8.8 and above.

Modules that themselves require composer/composer or composer/semver in their composer.json will be required to also upgrade to compatible versions of these packages. This is rare, and only applies to code that interacts with Composer directly.

Troubleshooting

Drush

Previous versions of Drush are not compatible with this change, because it depended on an older version of composer/semver. Drush users should update to the latest development version for compatibility with Drupal 9.1. (A Drush release with the fix will be made available at a later date.)

Conflicts with other dependencies

If, when upgrading to Drupal 9.1+ with Composer, you see a message like:

  Problem 1
    - Root composer.json requires my_project/my_package * -> satisfiable by my_project/my_package[...].
    - my_project/my_package dev-master requires composer/composer ^1 -> satisfiable by composer/composer[1.0.0-alpha1, ..., 1.10.x-dev].

This is a Composer 2 and PHP 8 compatibility issue with the my_project/my_package project (not Drupal core). Try updating any such packages to their latest versions, and if that does not resolve the issue, file an issue with the affected projects for Composer 2 and PHP 8 compatibility. If it says drupal/my_module_name, then the issue should be filed against that contributed or custom module.

@todo about global vs. project-local Composer installations

See comment #88. @todo

Preparing your site for Composer 2

Drupal 8.8, 8.9, 9.0, and 9.1 were already made compatible with Composer 2 prior to this change. For general recommendations on using Composer 2 with your project, read Preparing your site for Composer 2.

Impacts: 
Module developers