1
0
Fork 0

Respect sort-packages option when adding plugins to the allow-plugins list, fixes #11348

pull/12114/head
Jordi Boggiano 2024-09-18 16:57:22 +02:00
parent e5af569bfc
commit dea55ec139
No known key found for this signature in database
1 changed files with 9 additions and 1 deletions

View File

@ -750,7 +750,15 @@ class PluginManager
// persist answer in composer.json if it wasn't simply discarded // persist answer in composer.json if it wasn't simply discarded
if ($answer === 'y' || $answer === 'n') { if ($answer === 'y' || $answer === 'n') {
$composer->getConfig()->getConfigSource()->addConfigSetting('allow-plugins.'.$package, $allow); $allowPlugins = $composer->getConfig()->get('allow-plugins');
if (is_array($allowPlugins)) {
$allowPlugins[$package] = $allow;
if ($composer->getConfig()->get('sort-packages')) {
ksort($allowPlugins);
}
$composer->getConfig()->getConfigSource()->addConfigSetting('allow-plugins', $allowPlugins);
$composer->getConfig()->merge(['config' => ['allow-plugins' => $allowPlugins]]);
}
} }
return $allow; return $allow;