From ded485dd60098878ed501bd2b7e44df1753ee0bd Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Tue, 9 Oct 2012 15:06:55 +0200 Subject: [PATCH] Fix root aliasing and allow aliasing using the branch-alias as source --- src/Composer/DependencyResolver/Pool.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/Composer/DependencyResolver/Pool.php b/src/Composer/DependencyResolver/Pool.php index 520b0c6e0..5ee39d9a9 100644 --- a/src/Composer/DependencyResolver/Pool.php +++ b/src/Composer/DependencyResolver/Pool.php @@ -101,16 +101,23 @@ class Pool } } - foreach (array_keys($names) as $name) { - $this->packageByName[$name][] =& $this->packages[$id-2]; + foreach (array_keys($names) as $provided) { + $this->packageByName[$provided][] =& $this->packages[$id-2]; } // handle root package aliases + unset($rootAliasData); if (isset($rootAliases[$name][$version])) { + $rootAliasData = $rootAliases[$name][$version]; + } elseif (isset($package['alias_normalized']) && isset($rootAliases[$name][$package['alias_normalized']])) { + $rootAliasData = $rootAliases[$name][$package['alias_normalized']]; + } + + if (isset($rootAliasData)) { $alias = $package; unset($alias['raw']); - $alias['version'] = $rootAliases[$name][$version]['alias_normalized']; - $alias['alias'] = $rootAliases[$name][$version]['alias']; + $alias['version'] = $rootAliasData['alias_normalized']; + $alias['alias'] = $rootAliasData['alias']; $alias['alias_of'] = $package['id']; $alias['id'] = $id++; $alias['root_alias'] = true;