Skip to content

Bug: Seems to be trying to download Composer from an incorrect URL #1025

@anomiex

Description

@anomiex

Describe the bug

We've had a spate of failures like this recently:

==> Setup PHP
✓ PHP Installed PHP 7.4.33

==> Setup Extensions
✓ mysql Enabled
✓ imagick Enabled

==> Setup Tools
✗ composer Failed to download composer from https://github.com/composer/composer/releases/download/2.8.12/composer.phar https://getcomposer.org/composer-2.8.12.phar

We note that the second URL there, https://getcomposer.org/composer-2.8.12.phar, is a 404. The proper URL to download Composer from getcomposer.org seems to be https://getcomposer.org/download/2.8.12/composer.phar.

If I'm not mistaken, that URL seems to be constructed here

const version_source_url = `${getcomposer}/composer-${channel}.phar`;

Presumably it works most of the time, but if the github.com URL fails then the fallback to getcomposer.org will never succeed either due the the invalid URL.

Version

  • v2
  • v1

Runners

GitHub Hosted

Operating systems

ubuntu-latest (currently Ubuntu 24.04)

PHP versions

Various from 7.2 to 8.5.

To Reproduce

    - name: Setup PHP
      if: steps.versions.outputs.php-version != 'false'
      uses: shivammathur/setup-php@v2
      with:
        php-version: ${{ steps.versions.outputs.php-version }}
        ini-values: error_reporting=E_ALL, display_errors=On, zend.assertions=1
        tools: composer:${{ steps.versions.outputs.composer-version }}
        extensions: mysql, imagick
        coverage: ${{ inputs.coverage }}
  • steps.versions.outputs.php-version will be a two-component version between 7.2 and 8.5.
  • steps.versions.outputs.composer-version is currently 2.8.12.
  • inputs.coverage will be "none" or "pcov".

Expected behavior

Composer is installed.

Screenshots/Logs

==> Setup PHP
✓ PHP Installed PHP 7.4.33

==> Setup Extensions
✓ mysql Enabled
✓ imagick Enabled

==> Setup Tools
✗ composer Failed to download composer from https://github.com/composer/composer/releases/download/2.8.12/composer.phar https://getcomposer.org/composer-2.8.12.phar

Additional context

No response

Are you willing to submit a PR?

Yes

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions