1
0
Fork 0

Fix unsetting of existing props, fixes #10767, refs #10756

pull/10769/head
Jordi Boggiano 2022-05-11 13:52:49 +02:00
parent 6af9fb63f5
commit ebfdae8883
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
1 changed files with 6 additions and 0 deletions

View File

@ -634,6 +634,11 @@ EOT
if ($input->getOption('global') && (isset($uniqueProps[$settingKey]) || isset($multiProps[$settingKey]) || strpos($settingKey, 'extra.') === 0)) { if ($input->getOption('global') && (isset($uniqueProps[$settingKey]) || isset($multiProps[$settingKey]) || strpos($settingKey, 'extra.') === 0)) {
throw new \InvalidArgumentException('The ' . $settingKey . ' property can not be set in the global config.json file. Use `composer global config` to apply changes to the global composer.json'); throw new \InvalidArgumentException('The ' . $settingKey . ' property can not be set in the global config.json file. Use `composer global config` to apply changes to the global composer.json');
} }
if ($input->getOption('unset') && (isset($uniqueProps[$settingKey]) || isset($multiProps[$settingKey]))) {
$this->configSource->removeProperty($settingKey);
return 0;
}
if (isset($uniqueProps[$settingKey])) { if (isset($uniqueProps[$settingKey])) {
$this->handleSingleValue($settingKey, $uniqueProps[$settingKey], $values, 'addProperty'); $this->handleSingleValue($settingKey, $uniqueProps[$settingKey], $values, 'addProperty');
@ -796,6 +801,7 @@ EOT
return 0; return 0;
} }
// handle unsetting other top level properties
if ($input->getOption('unset')) { if ($input->getOption('unset')) {
$this->configSource->removeProperty($settingKey); $this->configSource->removeProperty($settingKey);