1
0
Fork 0

Merge branch '1.4'

pull/6281/head
Jordi Boggiano 2017-03-17 22:33:28 +01:00
commit 74f18133da
2 changed files with 16 additions and 0 deletions

View File

@ -520,6 +520,7 @@
* Initial release * Initial release
[1.4.1]: https://github.com/composer/composer/compare/1.4.0...1.4.1
[1.4.0]: https://github.com/composer/composer/compare/1.3.3...1.4.0 [1.4.0]: https://github.com/composer/composer/compare/1.3.3...1.4.0
[1.3.3]: https://github.com/composer/composer/compare/1.3.2...1.3.3 [1.3.3]: https://github.com/composer/composer/compare/1.3.2...1.3.3
[1.3.2]: https://github.com/composer/composer/compare/1.3.1...1.3.2 [1.3.2]: https://github.com/composer/composer/compare/1.3.1...1.3.2

View File

@ -60,6 +60,21 @@ class JsonConfigSource implements ConfigSourceInterface
public function addRepository($name, $config) public function addRepository($name, $config)
{ {
$this->manipulateJson('addRepository', $name, $config, function (&$config, $repo, $repoConfig) { $this->manipulateJson('addRepository', $name, $config, function (&$config, $repo, $repoConfig) {
// if converting from an array format to hashmap format, and there is a {"packagist.org":false} repo, we have
// to convert it to "packagist.org": false key on the hashmap otherwise it fails schema validation
if (isset($config['repositories'])) {
foreach ($config['repositories'] as $index => $val) {
if ($index === $repo) {
continue;
}
if (is_numeric($index) && ($val === array('packagist' => false) || $val === array('packagist.org' => false))) {
unset($config['repositories'][$index]);
$config['repositories']['packagist.org'] = false;
break;
}
}
}
$config['repositories'][$repo] = $repoConfig; $config['repositories'][$repo] = $repoConfig;
}); });
} }