1
0
Fork 0

Fixed PoolBuilder running endlessly when packages do not exist

pull/8850/head
Yanick Witschi 2020-04-30 17:32:25 +02:00 committed by Jordi Boggiano
parent 28f82032cd
commit bca88bdd4b
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
2 changed files with 32 additions and 3 deletions

View File

@ -249,6 +249,8 @@ class PoolBuilder
$this->loadedNames[$name] = $constraint;
}
$preLoad = $this->packagesToLoad;
foreach ($repositories as $repository) {
if (empty($this->packagesToLoad)) {
break;
@ -271,9 +273,11 @@ class PoolBuilder
}
// Make sure we empty the packagesToLoad here as it would result
// in an endless loop with non-existent packages for example
// TODO: fixme, this should only happen if it's not a new package
// $this->packagesToLoad = array();
// in an endless loop if the array remains unchanged.
// This could happen with non-existent packages for example.
if ($preLoad == $this->packagesToLoad) {
$this->packagesToLoad = array();
}
}
private function loadPackage(Request $request, PackageInterface $package, $propagateUpdate = true)

View File

@ -0,0 +1,25 @@
--TEST--
Test irrelevant package versions are not loaded
--REQUEST--
{
"require": {
"root/req": "*"
}
}
--FIXED--
[
]
--PACKAGES--
[
{"name": "root/req", "version": "1.0.0", "require": {"dep/dep": "2.*"}},
{"name": "dep/dep", "version": "2.3.4", "require": {"dep/dep3": "2.*"}}
]
--EXPECT--
[
"root/req-1.0.0.0",
"dep/dep-2.3.4.0"
]