1
0
Fork 0

Fix json manipulation fallback handling of empty objects, fixes #8600

pull/8611/head
Jordi Boggiano 2020-02-14 09:33:53 +01:00
parent 881d743ac0
commit 850bfcddfa
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
1 changed files with 6 additions and 0 deletions

View File

@ -246,6 +246,12 @@ class JsonConfigSource implements ConfigSourceInterface
$config = $this->file->read();
$this->arrayUnshiftRef($args, $config);
call_user_func_array($fallback, $args);
// avoid ending up with arrays for keys that should be objects
foreach (array('require', 'require-dev', 'conflict', 'provide', 'replace', 'suggest', 'config', 'autoload', 'autoload-dev') as $linkType) {
if (isset($config[$linkType]) && $config[$linkType] === array()) {
$config[$linkType] = new \stdClass;
}
}
$this->file->write($config);
}