Skip to content

Commit a0d1d59

Browse files
committed
Fix handling of aliases in streamable repos, fixes composer#1776, fixes composer#1749
1 parent e82cf68 commit a0d1d59

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/Composer/DependencyResolver/Pool.php

+6-3
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public function addRepository(RepositoryInterface $repo, $rootAliases = array())
112112
$this->packages[] = $package;
113113

114114
foreach ($names as $provided) {
115-
$this->packageByName[$provided][] =& $this->packages[$this->id - 2];
115+
$this->packageByName[$provided][$package['id']] = $this->packages[$this->id - 2];
116116
}
117117

118118
// handle root package aliases
@@ -134,7 +134,7 @@ public function addRepository(RepositoryInterface $repo, $rootAliases = array())
134134
$this->packages[] = $alias;
135135

136136
foreach ($names as $provided) {
137-
$this->packageByName[$provided][] =& $this->packages[$this->id - 2];
137+
$this->packageByName[$provided][$alias['id']] = $this->packages[$this->id - 2];
138138
}
139139
}
140140

@@ -149,7 +149,7 @@ public function addRepository(RepositoryInterface $repo, $rootAliases = array())
149149
$this->packages[] = $alias;
150150

151151
foreach ($names as $provided) {
152-
$this->packageByName[$provided][] =& $this->packages[$this->id - 2];
152+
$this->packageByName[$provided][$alias['id']] = $this->packages[$this->id - 2];
153153
}
154154
}
155155
}
@@ -349,6 +349,9 @@ private function ensurePackageIsLoaded($data)
349349
$package = $this->packages[$data['id'] - 1] = $data['repo']->loadPackage($data);
350350
}
351351

352+
foreach ($package->getNames() as $name) {
353+
$this->packageByName[$name][$data['id']] = $package;
354+
}
352355
$package->setId($data['id']);
353356
$data = $package;
354357
}

0 commit comments

Comments
 (0)