From ca3b8744144ec223aa87f90aec7aa7c7be0b73bc Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Thu, 17 Mar 2022 10:38:24 +0100 Subject: [PATCH] Fix issue in remove command when allow-plugins is not present at all, fixes #10629 --- src/Composer/Command/RemoveCommand.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Composer/Command/RemoveCommand.php b/src/Composer/Command/RemoveCommand.php index 2829461fd..75411f8ce 100644 --- a/src/Composer/Command/RemoveCommand.php +++ b/src/Composer/Command/RemoveCommand.php @@ -235,8 +235,8 @@ EOT $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent); $allowPlugins = $composer->getConfig()->get('allow-plugins'); - $removedPlugins = array_intersect(array_keys($allowPlugins), $packages); - if (!$dryRun && count($removedPlugins) !== 0) { + $removedPlugins = is_array($allowPlugins) ? array_intersect(array_keys($allowPlugins), $packages) : []; + if (!$dryRun && count($removedPlugins) > 0) { if (count($allowPlugins) === count($removedPlugins)) { $json->removeConfigSetting('allow-plugins'); } else {