From 2bcd723b5406fa083c54c9e7b9026f87361932ab Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Fri, 29 Apr 2016 15:31:18 +0100 Subject: [PATCH] Fix regression in global command, fixes #5266 --- src/Composer/Command/GlobalCommand.php | 1 + src/Composer/Console/Application.php | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Composer/Command/GlobalCommand.php b/src/Composer/Command/GlobalCommand.php index 86baeeade..9aa48706b 100644 --- a/src/Composer/Command/GlobalCommand.php +++ b/src/Composer/Command/GlobalCommand.php @@ -76,6 +76,7 @@ EOT // create new input without "global" command prefix $input = new StringInput(preg_replace('{\bg(?:l(?:o(?:b(?:a(?:l)?)?)?)?)?\b}', '', $input->__toString(), 1)); + $this->getApplication()->resetComposer(); return $this->getApplication()->run($input, $output); } diff --git a/src/Composer/Console/Application.php b/src/Composer/Console/Application.php index 5c1bdc529..60ac50508 100644 --- a/src/Composer/Console/Application.php +++ b/src/Composer/Console/Application.php @@ -116,7 +116,9 @@ class Application extends BaseApplication } } - if ($commandName !== 'global' && $commandName !== 'outdated') { + $isProxyCommand = $commandName === 'global' || $commandName === 'outdated'; + + if (!$isProxyCommand) { $io->writeError(sprintf( 'Running %s (%s) with %s on %s', Composer::VERSION, @@ -194,7 +196,7 @@ class Application extends BaseApplication $this->io->enableDebugging($startTime); } - if (!$input->hasParameterOption('--no-plugins')) { + if (!$input->hasParameterOption('--no-plugins') && !$isProxyCommand) { foreach ($this->getPluginCommands() as $command) { if ($this->has($command->getName())) { $io->writeError('Plugin command '.$command->getName().' ('.get_class($command).') would override a Composer command and has been skipped');