magento / magento/composer-dependency-version-audit-plugin

Install failure with some versions of Composer 2

Open
#2 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
5
Forks
7
PR merge metrics
No merged PRs in 30d

Description

We have a deployment image that installs composer2 from https://getcomposer.org/composer.phar before installation. The version that's currently installed is...

```bash
$ composer -v
______
/ ____/___ ____ ___ ____ ____ ________ _____
/ / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
/_/
Composer version 2.1-dev (2.1-dev+d7154c2a72101b40c0f93daeea9b81dd484129c3) 2021-11-02 13:39:04
```

When I try to install Magento 2.4.3 from composer, the installation fails when I get to this dependency version verifier package with the following error:

```bash
$ composer install
...
- Installing composer/ca-bundle (1.3.1): Extracting archive
- Installing composer/composer (1.10.23): Extracting archive
- Installing colinmollenhour/credis (1.11.1): Extracting archive
- Installing colinmollenhour/php-redis-session-abstract (v1.4.4): Extracting archive
- Installing magento/framework (103.0.3-p1): Extracting archive
- Installing squizlabs/php_codesniffer (3.5.8): Extracting archive
- Installing dealerdirect/phpcodesniffer-composer-installer (v0.7.1): Extracting archive
- Installing magento/composer-dependency-version-audit-plugin (0.1.1): Extracting archive


[Exception]
Unrecognized Composer Version

install [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--dry-run] [--dev] [--no-suggest] [--no-dev] [--no-autoloader] [--no-scripts] [--no-progress] [--no-install] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--apcu-autoloader-prefix APCU-AUTOLOADER-PREFIX] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--] []...
```

I believe the issue is that the version parsing this module is performing isn't taking into account the `-dev` suffix in the version, and errors out as it cannot identify this composer version. Replacing composer with this version https://getcomposer.org/download/2.1.12/composer.phar which reports as `Composer version 2.1.12 2021-11-09 16:02:04` allows me to complete the installation. I believe the logic here needs to match even with these version suffixes.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file or test is named. Reproduce the failure with the reported Composer 2.1-dev version and Magento 2.4.3, then trace the Composer version parsing used during composer install. Done means development-suffixed Composer versions are accepted while the installation completes without the Unrecognized Composer Version exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.