Upgrade composer to 2.8.0 for PHP 8.4

Created on 2 October 2024, 3 months ago

Problem/Motivation

Full support for PHP 8.4 was added to composer via https://github.com/composer/composer/commit/8ae6fa1205897dcfc57867542c94...

Steps to reproduce

See parent issue and patch

Proposed resolution

Upgrade composer to new minor version and backport it to 10.4.x

Remaining tasks

review/commit

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

πŸ“Œ Task
Status

Active

Version

11.0 πŸ”₯

Component

composer

Created by

πŸ‡«πŸ‡·France andypost

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @andypost
  • πŸ‡«πŸ‡·France andypost

    11.x changes

    +----------------------------------+---------+---------+
    | Production Changes               | From    | To      |
    +----------------------------------+---------+---------+
    | composer/semver                  | 3.4.2   | 3.4.3   |
    | psr/log                          | 3.0.0   | 3.0.2   |
    | symfony/console                  | v7.1.3  | v7.1.5  |
    | symfony/filesystem               | v7.1.2  | v7.1.5  |
    | symfony/finder                   | v7.1.3  | v7.1.4  |
    | symfony/polyfill-ctype           | v1.30.0 | v1.31.0 |
    | symfony/polyfill-intl-grapheme   | v1.30.0 | v1.31.0 |
    | symfony/polyfill-intl-normalizer | v1.30.0 | v1.31.0 |
    | symfony/polyfill-mbstring        | v1.30.0 | v1.31.0 |
    | symfony/process                  | v7.1.3  | v7.1.5  |
    | symfony/string                   | v7.1.3  | v7.1.5  |
    +----------------------------------+---------+---------+
    
    +--------------------+-------+-------+
    | Dev Changes        | From  | To    |
    +--------------------+-------+-------+
    | composer/ca-bundle | 1.5.1 | 1.5.2 |
    | composer/composer  | 2.7.7 | 2.8.0 |
    | composer/pcre      | 3.2.0 | 3.3.1 |
    +--------------------+-------+-------+
    

    10.4.x changes require to upgrade phpStan

    +----------------------------------+---------+---------+
    | Production Changes               | From    | To      |
    +----------------------------------+---------+---------+
    | composer/semver                  | 3.4.0   | 3.4.3   |
    | psr/log                          | 3.0.0   | 3.0.2   |
    | symfony/console                  | v6.4.8  | v6.4.12 |
    | symfony/filesystem               | v6.4.8  | v6.4.12 |
    | symfony/finder                   | v6.4.8  | v6.4.11 |
    | symfony/polyfill-ctype           | v1.29.0 | v1.31.0 |
    | symfony/polyfill-intl-grapheme   | v1.29.0 | v1.31.0 |
    | symfony/polyfill-intl-normalizer | v1.29.0 | v1.31.0 |
    | symfony/polyfill-mbstring        | v1.29.0 | v1.31.0 |
    | symfony/process                  | v6.4.8  | v6.4.12 |
    | symfony/string                   | v6.4.8  | v6.4.12 |
    +----------------------------------+---------+---------+
    
    +---------------------------+---------+--------+
    | Dev Changes               | From    | To     |
    +---------------------------+---------+--------+
    | composer/ca-bundle        | 1.5.0   | 1.5.2  |
    | justinrainbow/json-schema | v5.2.13 | 5.3.0  |
    | seld/jsonlint             | 1.10.2  | 1.11.0 |
    +---------------------------+---------+--------+
    
  • πŸ‡«πŸ‡·France andypost

    Final 10.4.x changes

    | Production Changes               | From    | To      |
    +----------------------------------+---------+---------+
    | composer/semver                  | 3.4.0   | 3.4.3   |
    | psr/log                          | 3.0.0   | 3.0.2   |
    | symfony/console                  | v6.4.8  | v6.4.12 |
    | symfony/filesystem               | v6.4.8  | v6.4.12 |
    | symfony/finder                   | v6.4.8  | v6.4.11 |
    | symfony/polyfill-ctype           | v1.29.0 | v1.31.0 |
    | symfony/polyfill-intl-grapheme   | v1.29.0 | v1.31.0 |
    | symfony/polyfill-intl-normalizer | v1.29.0 | v1.31.0 |
    | symfony/polyfill-mbstring        | v1.29.0 | v1.31.0 |
    | symfony/process                  | v6.4.8  | v6.4.12 |
    | symfony/string                   | v6.4.8  | v6.4.12 |
    +----------------------------------+---------+---------+
    
    +---------------------------+---------+--------+
    | Dev Changes               | From    | To     |
    +---------------------------+---------+--------+
    | composer/ca-bundle        | 1.5.0   | 1.5.2  |
    | composer/composer         | 2.7.7   | 2.8.0  |
    | composer/pcre             | 3.1.4   | 3.3.1  |
    | justinrainbow/json-schema | v5.2.13 | 5.3.0  |
    | nikic/php-parser          | v5.2.0  | v5.3.0 |
    | phpstan/phpdoc-parser     | 1.29.0  | 1.32.0 |
    | phpstan/phpstan           | 1.11.0  | 1.12.5 |
    | seld/jsonlint             | 1.10.2  | 1.11.0 |
    +---------------------------+---------+--------+
    
    
  • Pipeline finished with Success
    3 months ago
    Total: 770s
    #299189
  • Pipeline finished with Canceled
    3 months ago
    Total: 628s
    #299190
  • Pipeline finished with Failed
    3 months ago
    Total: 116s
    #299195
  • πŸ‡«πŸ‡·France andypost

    10.4.x needs more work to support PhpStan 1.12.x

  • πŸ‡¬πŸ‡§United Kingdom longwave UK

    Looks good but NW to fix the PHPStan issues in 10.4.

  • πŸ‡«πŸ‡·France andypost

    Using composer update composer/composer phpstan/phpstan --with=phpstan/phpstan:1.11.10 -W solved the trick

    But there's still failures, so I filed separate issue for 10.4 upgrade of phpstan to inline its version with 11.x πŸ“Œ upgrade phpstan to 1.11.10 for 10.4.x Active

    +----------------------------------+---------+---------+
    | Production Changes               | From    | To      |
    +----------------------------------+---------+---------+
    | composer/semver                  | 3.4.0   | 3.4.3   |
    | psr/log                          | 3.0.0   | 3.0.2   |
    | symfony/console                  | v6.4.8  | v6.4.12 |
    | symfony/filesystem               | v6.4.8  | v6.4.12 |
    | symfony/finder                   | v6.4.8  | v6.4.11 |
    | symfony/polyfill-ctype           | v1.29.0 | v1.31.0 |
    | symfony/polyfill-intl-grapheme   | v1.29.0 | v1.31.0 |
    | symfony/polyfill-intl-normalizer | v1.29.0 | v1.31.0 |
    | symfony/polyfill-mbstring        | v1.29.0 | v1.31.0 |
    | symfony/process                  | v6.4.8  | v6.4.12 |
    | symfony/string                   | v6.4.8  | v6.4.12 |
    +----------------------------------+---------+---------+
    
    +---------------------------+---------+---------+
    | Dev Changes               | From    | To      |
    +---------------------------+---------+---------+
    | composer/ca-bundle        | 1.5.0   | 1.5.2   |
    | composer/composer         | 2.7.7   | 2.8.0   |
    | composer/pcre             | 3.1.4   | 3.3.1   |
    | justinrainbow/json-schema | v5.2.13 | 5.3.0   |
    | phpstan/phpstan           | 1.11.0  | 1.11.10 |
    | seld/jsonlint             | 1.10.2  | 1.11.0  |
    +---------------------------+---------+---------+
    
  • Pipeline finished with Failed
    3 months ago
    Total: 6823s
    #299846
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    The 10.4 MR appears to be failing consistently

  • πŸ‡«πŸ‡·France andypost

    Yes, 10.4 require bump for phpstan and few fixes backported from earlier 11.x upgrades

  • πŸ‡«πŸ‡·France andypost

    Today there's bug-fix release so I set it composer.json

    +------------------------------+-------+-------+
    | Dev Changes                  | From  | To    |
    +------------------------------+-------+-------+
    | composer/class-map-generator | 1.3.4 | 1.4.0 |
    | composer/composer            | 2.8.0 | 2.8.1 |
    +------------------------------+-------+-------+
    
  • Pipeline finished with Success
    3 months ago
    Total: 1044s
    #301000
  • Pipeline finished with Success
    3 months ago
    Total: 5901s
    #300992
  • πŸ‡«πŸ‡·France andypost

    10.4 blocker commited I bet it's time for this one

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Seems the 10.4 MR needs a manual rebase.

  • πŸ‡«πŸ‡·France andypost

    Rebased

  • Pipeline finished with Failed
    3 months ago
    Total: 139s
    #303431
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Been trying to keep up so you don’t have to do a million rebases but seems latest still isn’t passing 10.4

  • πŸ‡«πŸ‡·France andypost

    fixed via composer update --lock

  • Pipeline finished with Success
    3 months ago
    Total: 1899s
    #303460
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Now this appears to be good to go. Thanks!

  • πŸ‡«πŸ‡·France andypost

    restarted for

    ---- Drupal\Tests\page_cache\Functional\PageCacheTest ----
    Status    Group      Filename          Line Function                            
    --------------------------------------------------------------------------------
    Exception Other      phpunit-5.xml        0 Drupal\Tests\page_cache\Functional\
        PHPUnit Test failed to complete; Error: PHPUnit 9.6.21 by Sebastian
        Bergmann and contributors.
        
        Testing Drupal\Tests\page_cache\Functional\PageCacheTest
        ...E.                                                               5 / 5
        (100%)
        
        Time: 01:17.599, Memory: 8.00 MB
        
        There was 1 error:
        
        1) Drupal\Tests\page_cache\Functional\PageCacheTest::testFormImmutability
        Behat\Mink\Exception\ResponseTextException: The text "Immutable: FALSE" was
        not found anywhere in the text of the current page.
        
        /builds/issue/drupal-3478331/vendor/behat/mink/src/WebAssert.php:907
        /builds/issue/drupal-3478331/vendor/behat/mink/src/WebAssert.php:293
        /builds/issue/drupal-3478331/core/tests/Drupal/Tests/WebAssert.php:979
        /builds/issue/drupal-3478331/core/modules/page_cache/tests/src/Functional/PageCacheTest.php:485
        /builds/issue/drupal-3478331/vendor/phpunit/phpunit/src/Framework/TestResult.php:729
        
        ERRORS!
        Tests: 5, Assertions: 189, Errors
    : 1.
        
    
    • longwave β†’ committed 5c8b515c on 11.x
      Issue #3478331 by andypost, smustgrave: Upgrade composer to 2.8.1 for...
    • longwave β†’ committed 00ebb2fc on 10.4.x
      Issue #3478331 by andypost, smustgrave: Upgrade composer to 2.8.1 for...
  • πŸ‡¬πŸ‡§United Kingdom longwave UK

    Committed 5c8b515 and pushed to 11.x. Thanks!

    Committed 00ebb2f and pushed to 10.4.x. Thanks!

  • πŸ‡¬πŸ‡§United Kingdom mcdruid πŸ‡¬πŸ‡§πŸ‡ͺπŸ‡Ί

    I think this may have broken some tests?

    See e.g. https://git.drupalcode.org/issue/drupal-3479411/-/jobs/2990908

    Drupal\BuildTests\Composer\Template\ComposerProjectTemplates   0 passes   17s   1 fails   <===                         
    Drupal\BuildTests\Composer\Component\ComponentsTaggedRelease   4 passes   41s                                      
    Drupal\BuildTests\Command\GenerateThemeTest                   16 passes   88s                                      
    Drupal\BuildTests\Composer\Component\ComponentsIsolatedBuild  24 passes  134s                                      
    Test run duration: 2 min 13 sec
    Detailed test results
    ---------------------
    ---- Drupal\BuildTests\Composer\Template\ComposerProjectTemplatesTest ----
    Status    Group      Filename          Line Function                            
    --------------------------------------------------------------------------------
    Fail      Other      phpunit-1.xml        0 Drupal\BuildTests\Composer\Template
        PHPUnit Test failed to complete; Error: PHPUnit 10.5.35 by Sebastian
        Bergmann and contributors.
        
        Runtime:       PHP 8.3.12
        Configuration: /builds/issue/drupal-3479411/core/phpunit.xml.dist
        
        ..FF                                                                4 / 4
        (100%)
        
        Time: 00:16.442, Memory: 14.00 MB
        
        There were 2 failures:
        
        1)
        Drupal\BuildTests\Composer\Template\ComposerProjectTemplatesTest::testTemplateCreateProject
        with data set "recommended-project" ('drupal/recommended-project',
        'composer/Template/RecommendedProject', '/web')
        COMMAND:
        COMPOSER_HOME=/tmp/build_workspace_142b3cf5f42e57cba5237822b73defbcu4lXMx/composer-home
        COMPOSER_ROOT_VERSION=11.0 composer create-project --no-ansi
        drupal/recommended-project test_project 11.0 -vvv --repository
        /tmp/build_workspace_142b3cf5f42e57cba5237822b73defbcu4lXMx/test_repository/packages.json
        OUTPUT: 
        ERROR: Running 2.8.1 (2024-10-04 11:31:01) with PHP 8.3.12 on Linux /
        5.10.225-213.878.amzn2.x86_64
        Reading ./composer.json
        (/tmp/build_workspace_142b3cf5f42e57cba5237822b73defbcu4lXMx/composer.json)
        Loading config file
        /tmp/build_workspace_142b3cf5f42e57cba5237822b73defbcu4lXMx/composer-home/config.json
        Loading config file
        /tmp/build_workspace_142b3cf5f42e57cba5237822b73defbcu4lXMx/composer-home/auth.json
        Loading config file ./composer.json
        (/tmp/build_workspace_142b3cf5f42e57cba5237822b73defbcu4lXMx/composer.json)
    
        ...snip...
    
    /tmp/build_workspace_142b3cf5f42e57cba5237822b73defbcu4lXMx/composer-home/cache/repo/file----tmp-build-workspace-142b3cf5f42e57cba5237822b73defbcu4lXMx-test-repository-packages.json/packages.json
    into cache
    Installing drupal/recommended-project (11.0)
    In PathDownloader.php line 51:
                                                                               
       
      [RuntimeException]                                                       
       
      Source path "composer/Template/RecommendedProject" is not found for
    package  
       drupal/recommended-project
    

    I can reproduce this by e.g. replacing ddev's current composer (2.7.9) with the phar for 2.8.1 then trying to run just that one test manually:

    mcdruid@drupal-10:/var/www/html$ vendor/phpunit/phpunit/phpunit -c core core/tests/Drupal/BuildTests/Composer/Template/ComposerProjectTemplatesTest.php
    PHPUnit 10.5.29 by Sebastian Bergmann and contributors.
    
    Runtime:       PHP 8.3.10
    Configuration: /var/www/html/core/phpunit.xml.mysql
    
    ..FF                                                                4 / 4 (100%)
    
    Time: 00:08.780, Memory: 14.00 MB
    
    There was 1 PHPUnit test runner deprecation:
    
    1) Your XML configuration validates against a deprecated schema. Migrate your XML configuration using "--migrate-configuration"!
    
    --
    
    There were 2 failures:
    
    1) Drupal\BuildTests\Composer\Template\ComposerProjectTemplatesTest::testTemplateCreateProject with data set "recommended-project" ('drupal/recommended-project', 'composer/Template/RecommendedProject', '/web')
    COMMAND: COMPOSER_HOME=/tmp/build_workspace_558dd1b0a4860999e23c68f3b3390b60dlYMeC/composer-home COMPOSER_ROOT_VERSION=11.0.6 composer create-project --no-ansi drupal/recommended-project test_project 11.0.6 -vvv --repository /tmp/build_workspace_558dd1b0a4860999e23c68f3b3390b60dlYMeC/test_repository/packages.json
    OUTPUT: 
    ERROR: Running 2.8.1 (2024-10-04 11:31:01) with PHP 8.3.10 on Linux / 6.8.0-40-generic
    
    ...snip...
    
    Installing drupal/recommended-project (11.0.6)
    
    In PathDownloader.php line 51:
                                                                                                              
      [RuntimeException]                                                                                      
      Source path "composer/Template/RecommendedProject" is not found for package drupal/recommended-project
    
    ...snip...
    
    Installing drupal/legacy-project (11.0.6)
    
    In PathDownloader.php line 51:
                                                                                                    
      [RuntimeException]                                                                            
      Source path "composer/Template/LegacyProject" is not found for package drupal/legacy-project
    

    (sorry the test output is quite verbose and it's hard to know exactly what might be significant)

  • πŸ‡«πŸ‡·France andypost

    The issue caused by updated CI image so it needs to rollback to 2.7.9

    Filed πŸ› Fix composer version to 2.7.9 for PHP 8.3 images Active and but it needs to get what's wrong with packaging system using fresh compose

  • πŸ‡¬πŸ‡§United Kingdom mcdruid πŸ‡¬πŸ‡§πŸ‡ͺπŸ‡Ί

    Cool, thanks - I've posted in #drupal-infrastructure in slack as I wasn't sure if it was coincidence that the composer version was bumped here..

    Thanks for filing an issue in the right place.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024