From b2ebe841e48d66512e72ec5dd6d50de8f91d153f Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Wed, 12 Oct 2022 11:03:52 +0200 Subject: [PATCH] Fixes plugin commands not being loaded during completion Closes #11074 Co-authored-by: Susanne Moog --- src/Composer/Console/Application.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Composer/Console/Application.php b/src/Composer/Console/Application.php index 16302d424..2a080067e 100644 --- a/src/Composer/Console/Application.php +++ b/src/Composer/Console/Application.php @@ -235,6 +235,9 @@ class Application extends BaseApplication false === $commandName // list command requires plugin commands to show them || in_array($commandName, ['', 'list', 'help'], true) + // autocompletion requires plugin commands but if we are running as root without COMPOSER_ALLOW_SUPERUSER + // we'd rather not autocomplete plugins than abort autocompletion entirely, so we avoid loading plugins in this case + || ($commandName === '_complete' && !$isNonAllowedRoot) ); if ($mayNeedPluginCommand && !$this->disablePluginsByDefault && !$this->hasPluginCommands) {