1
0
Fork 0

Fixed replaced packages being incorrectly missing when unlocked by an old version (#11629)

Co-authored-by: Nils Adermann <naderman@naderman.de>
pull/11639/head
Yanick Witschi 2023-09-13 10:42:47 +02:00 committed by GitHub
parent 1e4966c313
commit 5474dc9b5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 55 additions and 0 deletions

View File

@ -672,6 +672,10 @@ class PoolBuilder
private function markPackageNameForLoadingIfRequired(Request $request, string $name): void private function markPackageNameForLoadingIfRequired(Request $request, string $name): void
{ {
if ($this->isRootRequire($request, $name)) {
$this->markPackageNameForLoading($request, $name, $request->getRequires()[$name]);
}
foreach ($this->packages as $package) { foreach ($this->packages as $package) {
foreach ($package->getRequires() as $link) { foreach ($package->getRequires() as $link) {
if ($name === $link->getTarget()) { if ($name === $link->getTarget()) {

View File

@ -0,0 +1,49 @@
--TEST--
Ensure that a root package gets loaded which is replaced by old versions of another requirement
--REQUEST--
{
"require": {
"root/dep": "*",
"replaced/pkg": "1.0.0"
},
"locked": [
{"name": "root/dep", "version": "1.1.0", "require": {"replacer/pkg": "1.*"}},
{"name": "replacer/pkg", "version": "1.1.0"},
{"name": "replaced/pkg", "version": "1.0.0"}
],
"allowList": [
"root/dep"
],
"allowTransitiveDeps": true
}
--FIXED--
[
]
--PACKAGE-REPOS--
[
[
{"name": "root/dep", "version": "1.2.0", "require": {"replacer/pkg": "1.*"}},
{"name": "replacer/pkg", "version": "1.0.0", "replace": {"replaced/pkg": "1.0.0"}},
{"name": "replacer/pkg", "version": "1.1.0"},
{"name": "replaced/pkg", "version": "1.0.0"}
]
]
--EXPECT--
[
"replaced/pkg-1.0.0.0",
"replacer/pkg-1.0.0.0",
"replacer/pkg-1.1.0.0",
"root/dep-1.2.0.0"
]
--EXPECT-OPTIMIZED--
[
"replaced/pkg-1.0.0.0",
"replacer/pkg-1.0.0.0",
"replacer/pkg-1.1.0.0",
"root/dep-1.2.0.0"
]

View File

@ -97,6 +97,7 @@ Check that replacers from additional repositories are loaded when doing a partia
--EXPECT-- --EXPECT--
[ [
"base/package-1.0.0.0",
"indirect/replacer-1.2.0.0", "indirect/replacer-1.2.0.0",
"indirect/replacer-1.0.0.0", "indirect/replacer-1.0.0.0",
"replacer/package-1.2.0.0", "replacer/package-1.2.0.0",
@ -107,6 +108,7 @@ Check that replacers from additional repositories are loaded when doing a partia
--EXPECT-OPTIMIZED-- --EXPECT-OPTIMIZED--
[ [
"base/package-1.0.0.0",
"indirect/replacer-1.2.0.0", "indirect/replacer-1.2.0.0",
"indirect/replacer-1.0.0.0", "indirect/replacer-1.0.0.0",
"replacer/package-1.2.0.0", "replacer/package-1.2.0.0",