Fix issue in remove command when allow-plugins is not present at all, fixes #10629

main
Jordi Boggiano 2 years ago
parent dec123770f
commit ca3b874414
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC

@ -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 {

Loading…
Cancel
Save