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

Type error when adding dependency without version constraint #10712

uuf6429 opened this issue Apr 6, 2022 · 1 comment

Type error when adding dependency without version constraint #10712

uuf6429 opened this issue Apr 6, 2022 · 1 comment


Copy link

@uuf6429 uuf6429 commented Apr 6, 2022

My composer.json:

N/A (creating new one)

Output of composer diagnose:

omposer diagnose                                                                                                                                       1 ✘  22s   08:53:17  
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking oauth access: OK
Checking disk free space: OK
Checking pubkeys: 
Tags Public Key Fingerprint: 57815BA2 7E54DC31 7ECC7CC5 573090D0  87719BA6 8F3BB723 4E5D42D0 84A14642
Dev Public Key Fingerprint: 4AC45767 E5EC2265 2F0C1167 CBBB8A2B  0C708369 153E328C AD90147D AFE50952
Checking composer version: OK
Composer version: 2.3.3
PHP version: 7.3.33
PHP binary path: /usr/local/Cellar/php@7.3/7.3.33_2/bin/php
OpenSSL version: OpenSSL 1.1.1m  14 Dec 2021
cURL version: 7.82.0 libz 1.2.11 ssl (SecureTransport) OpenSSL/1.1.1n
zip: extension present, unzip present, 7-Zip present (7z)

When I run this command:

composer init

I get the following output:

composer init                                                                                                                                                     ✔  08:57:36  

  Welcome to the Composer config generator  

This command will guide you through creating your composer.json config.

Package name (<vendor>/<name>) [user/test]: 
Description []: 
Author [Christian Sciberras <christian@xxxxxxxxx>, n to skip]: 
Minimum Stability []: 
Package Type (e.g. library, project, metapackage, composer-plugin) []: 
License []: 

Define your dependencies.

Would you like to define your dependencies (require) interactively [yes]? 
Search for a package: symfony/process
Enter the version constraint to require (or leave blank to use the latest version): 

In PackageDiscoveryTrait.php line 228:
  trim() expects parameter 1 to be string, bool given  

Exception trace:
  at phar:///usr/local/bin/composer/src/Composer/Command/PackageDiscoveryTrait.php:228
 trim() at phar:///usr/local/bin/composer/src/Composer/Command/PackageDiscoveryTrait.php:228
 Composer\Command\InitCommand->Composer\Command\{closure}() at phar:///usr/local/bin/composer/vendor/symfony/console/Helper/QuestionHelper.php:474
 Symfony\Component\Console\Helper\QuestionHelper->validateAttempts() at phar:///usr/local/bin/composer/vendor/symfony/console/Helper/QuestionHelper.php:74
 Symfony\Component\Console\Helper\QuestionHelper->ask() at phar:///usr/local/bin/composer/src/Composer/IO/ConsoleIO.php:301
 Composer\IO\ConsoleIO->askAndValidate() at phar:///usr/local/bin/composer/src/Composer/Command/PackageDiscoveryTrait.php:237
 Composer\Command\InitCommand->determineRequirements() at phar:///usr/local/bin/composer/src/Composer/Command/InitCommand.php:415
 Composer\Command\InitCommand->interact() at phar:///usr/local/bin/composer/vendor/symfony/console/Command/Command.php:283
 Symfony\Component\Console\Command\Command->run() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:1015
 Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:299
 Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:334
 Composer\Console\Application->doRun() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:171
 Symfony\Component\Console\Application->run() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:130
 Composer\Console\Application->run() at phar:///usr/local/bin/composer/bin/composer:83
 require() at /usr/local/bin/composer:29

init [--name NAME] [--description DESCRIPTION] [--author AUTHO....

And I expected this to happen:

Package added, composer.json file is written.

Additionally, I just realised, shouldn't the stack trace only be visible with at least some level of verbosity? (I didn't specify any verbosity)

@Seldaek Seldaek added this to the 2.3 milestone Apr 7, 2022
@Seldaek Seldaek closed this as completed in 0efb557 Apr 7, 2022
@Seldaek Seldaek added the Bug label Apr 7, 2022
Copy link

@Seldaek Seldaek commented Apr 7, 2022

Thanks for the report

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

No branches or pull requests

2 participants