Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Normalising composer.json with packagist disabled causes bug #1242

Closed
xvilo opened this issue Dec 14, 2023 · 1 comment · Fixed by #1243
Closed

Normalising composer.json with packagist disabled causes bug #1242

xvilo opened this issue Dec 14, 2023 · 1 comment · Fixed by #1243
Assignees
Labels

Comments

@xvilo
Copy link

xvilo commented Dec 14, 2023

Steps required to reproduce the problem

  1. Require version 2.41.0
  2. Add this to the json:
  "repositories": {
    "packagist": false
  },
  1. Run composer normalize

Expected Result

I expect it to stay in sync with the supported format, e.g.:

  "repositories": {
    "packagist": false
  },

Actual Result

It changes it to:

  "repositories": {
    "packagist": [
      false
    ]
  },

This is invalid format and results in the following composer errors:

composer install -vvv
Running 2.6.3 (2023-09-15 09:38:21) with PHP 8.2.13 on Darwin / 23.2.0
Loading config file /Users/xvilo/.composer/auth.json

In Factory.php line 319:
                                                                                
  [Composer\Json\JsonValidationException]                                       
  "./composer.json" does not match the expected JSON schema:                    
   - repositories.packagist : Array value found, but an object is required      
   - repositories.packagist : Failed to match at least one schema               
   - repositories.packagist : Array value found, but a boolean is required      
   - repositories.packagist : Does not have a value in the enumeration [false]  
                                                                                

Exception trace:
  at phar:///opt/homebrew/Cellar/composer/2.6.3/bin/composer/src/Composer/Factory.php:319
 Composer\Factory->createComposer() at phar:///opt/homebrew/Cellar/composer/2.6.3/bin/composer/src/Composer/Factory.php:623
 Composer\Factory::create() at phar:///opt/homebrew/Cellar/composer/2.6.3/bin/composer/src/Composer/Console/Application.php:501
 Composer\Console\Application->getComposer() at phar:///opt/homebrew/Cellar/composer/2.6.3/bin/composer/src/Composer/Command/BaseCommand.php:101
 Composer\Command\BaseCommand->requireComposer() at phar:///opt/homebrew/Cellar/composer/2.6.3/bin/composer/src/Composer/Command/InstallCommand.php:105
 Composer\Command\InstallCommand->execute() at phar:///opt/homebrew/Cellar/composer/2.6.3/bin/composer/vendor/symfony/console/Command/Command.php:298
 Symfony\Component\Console\Command\Command->run() at phar:///opt/homebrew/Cellar/composer/2.6.3/bin/composer/vendor/symfony/console/Application.php:1040
 Symfony\Component\Console\Application->doRunCommand() at phar:///opt/homebrew/Cellar/composer/2.6.3/bin/composer/vendor/symfony/console/Application.php:301
 Symfony\Component\Console\Application->doRun() at phar:///opt/homebrew/Cellar/composer/2.6.3/bin/composer/src/Composer/Console/Application.php:382
 Composer\Console\Application->doRun() at phar:///opt/homebrew/Cellar/composer/2.6.3/bin/composer/vendor/symfony/console/Application.php:171
 Symfony\Component\Console\Application->run() at phar:///opt/homebrew/Cellar/composer/2.6.3/bin/composer/src/Composer/Console/Application.php:145
 Composer\Console\Application->run() at phar:///opt/homebrew/Cellar/composer/2.6.3/bin/composer/bin/composer:88
 require() at /opt/homebrew/Cellar/composer/2.6.3/bin/composer:29

The last working version seems to be 2.30.0, downgrading from 2.41.0 results in the following changes:

Lock file operations: 0 installs, 2 updates, 0 removals
  - Downgrading ergebnis/composer-normalize (2.41.0 => 2.30.0)
  - Downgrading ergebnis/json-normalizer (4.4.0 => 4.0.2)

Documentation about this config can be found here https://getcomposer.org/doc/05-repositories.md#disabling-packagist-org

@localheinz
Copy link
Member

Thank you for reporting, @xvilo!

Released as ergebnis/composer-normalize:2.41.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants