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

Error with composer when using this plugin and it's allowed in composer.json #73

Closed
tarlepp opened this issue Apr 13, 2022 · 1 comment · Fixed by #97
Closed

Error with composer when using this plugin and it's allowed in composer.json #73

tarlepp opened this issue Apr 13, 2022 · 1 comment · Fixed by #97

Comments

@tarlepp
Copy link

tarlepp commented Apr 13, 2022

Command composer update --dry-run roave/security-advisories fails if composer.json config.allow-plugins contains "bamarni/composer-bin-plugin": true

With that allow-plugins:

dev@php-fpm:/app$ composer update --dry-run roave/security-advisories 

In Input.php line 193:
                                                                                                                  
  [TypeError]                                                                                                     
  Symfony\Component\Console\Input\Input::escapeToken(): Argument #1 ($token) must be of type string, array given  
                                                                                                                  

Exception trace:
  at phar:///usr/bin/composer/vendor/symfony/console/Input/Input.php:193
 Symfony\Component\Console\Input\Input->escapeToken() at n/a:n/a
 array_map() at phar:///usr/bin/composer/vendor/symfony/console/Input/ArrayInput.php:120
 Symfony\Component\Console\Input\ArrayInput->__toString() at /app/vendor/bamarni/composer-bin-plugin/src/BinCommand.php:52
 Bamarni\Composer\Bin\BinCommand->execute() at phar:///usr/bin/composer/vendor/symfony/console/Command/Command.php:298
 Symfony\Component\Console\Command\Command->run() at /app/vendor/bamarni/composer-bin-plugin/src/Plugin.php:123
 Bamarni\Composer\Bin\Plugin->onCommandEventInstallUpdate() at /app/vendor/bamarni/composer-bin-plugin/src/Plugin.php:84
 Bamarni\Composer\Bin\Plugin->onCommandEvent() at n/a:n/a
 call_user_func() at phar:///usr/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:202
 Composer\EventDispatcher\EventDispatcher->doDispatch() at phar:///usr/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:108
 Composer\EventDispatcher\EventDispatcher->dispatch() at phar:///usr/bin/composer/src/Composer/Command/UpdateCommand.php:196
 Composer\Command\UpdateCommand->execute() at phar:///usr/bin/composer/vendor/symfony/console/Command/Command.php:298
 Symfony\Component\Console\Command\Command->run() at phar:///usr/bin/composer/vendor/symfony/console/Application.php:1015
 Symfony\Component\Console\Application->doRunCommand() at phar:///usr/bin/composer/vendor/symfony/console/Application.php:299
 Symfony\Component\Console\Application->doRun() at phar:///usr/bin/composer/src/Composer/Console/Application.php:334
 Composer\Console\Application->doRun() at phar:///usr/bin/composer/vendor/symfony/console/Application.php:171
 Symfony\Component\Console\Application->run() at phar:///usr/bin/composer/src/Composer/Console/Application.php:130
 Composer\Console\Application->run() at phar:///usr/bin/composer/bin/composer:88
 require() at /usr/bin/composer:29

update [--with WITH] [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--dry-run] [--dev] [--no-dev] [--lock] [--no-install] [--no-autoloader] [--no-suggest] [--no-progress] [-w|--with-dependencies] [-W|--with-all-dependencies] [-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] [--prefer-stable] [--prefer-lowest] [-i|--interactive] [--root-reqs] [--] [<packages>...]

dev@php-fpm:/app$ 

and without it (expected result):

dev@php-fpm:/app$ composer update --dry-run roave/security-advisories 
bamarni/composer-bin-plugin contains a Composer plugin which is currently not in your allow-plugins config. See https://getcomposer.org/allow-plugins
Do you trust "bamarni/composer-bin-plugin" to execute code and wish to enable it now? (writes "allow-plugins" to composer.json) [y,n,d,?] n
Loading composer repositories with package information
Updating dependencies
Nothing to modify in lock file
Installing dependencies from lock file (including require-dev)
Nothing to install, update or remove
80 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
dev@php-fpm:/app$

also if I use --no-plugins option, it works as expected;

dev@php-fpm:/app$ composer update --dry-run --no-plugins roave/security-advisories 
Loading composer repositories with package information
Info from https://repo.packagist.org: #StandWithUkraine
Updating dependencies
Nothing to modify in lock file
Installing dependencies from lock file (including require-dev)
Nothing to install, update or remove
80 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
dev@php-fpm:/app$ 
@theofidry theofidry mentioned this issue Jul 8, 2022
@theofidry
Copy link
Collaborator

@tarlepp this looks like a very curious issue. From what I can see it's failing here. However I don't see why. I added a test in #97 just in case though.

I tried to reproduce the issue but without success. If it persist do tell me I'll re-open the issue.

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

Successfully merging a pull request may close this issue.

2 participants