From 9ced20fd0df986ed930def71bff76bd7f9fa8157 Mon Sep 17 00:00:00 2001 From: Yanick Witschi Date: Tue, 2 May 2023 23:11:20 +0200 Subject: [PATCH] Take the short cut --- src/Composer/DependencyResolver/PoolBuilder.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Composer/DependencyResolver/PoolBuilder.php b/src/Composer/DependencyResolver/PoolBuilder.php index 01115fd65..fc3b95968 100644 --- a/src/Composer/DependencyResolver/PoolBuilder.php +++ b/src/Composer/DependencyResolver/PoolBuilder.php @@ -662,8 +662,10 @@ class PoolBuilder foreach ($lockedPackage->getReplaces() as $replace) { if (isset($requires[$replace->getTarget()], $this->skippedLoad[$replace->getTarget()])) { $this->unlockPackage($request, $repositories, $replace->getTarget()); - // Mark as optional - if no other package requires it, we don't need to load it - $this->markPackageNameForOptionalLoading($replace->getTarget()); + // Do not call markPackageNameForOptionalLoading() here, we know that $lockedPackage is already + // part of $this->packages, and we check for $requires[$replace->getTarget()] so we're guaranteed + // to require this package. + $this->markPackageNameForLoading($request, $replace->getTarget(), $replace->getConstraint()); } } }