From 710bb0d0083eb8a0c476448d321fd80646efeddc Mon Sep 17 00:00:00 2001 From: Rob Bast Date: Tue, 27 Sep 2016 17:17:30 +0200 Subject: [PATCH] fix based on test, fixes #5724 --- src/Composer/Package/Version/VersionSelector.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Composer/Package/Version/VersionSelector.php b/src/Composer/Package/Version/VersionSelector.php index 817d5ed48..8e225d803 100644 --- a/src/Composer/Package/Version/VersionSelector.php +++ b/src/Composer/Package/Version/VersionSelector.php @@ -71,11 +71,21 @@ class VersionSelector $candidatePriority = $candidate->getStabilityPriority(); $currentPriority = $package->getStabilityPriority(); - // candidate is less stable than our preferred stability, and we have a package that is more stable than it, so we skip it + // candidate is less stable than our preferred stability, + // and current package is more stable than candidate, skip it if ($minPriority < $candidatePriority && $currentPriority < $candidatePriority) { continue; } - // candidate is more stable than our preferred stability, and current package is less stable than preferred stability, then we select the candidate always + + // candidate is less stable than our preferred stability, + // and current package is less stable than candidate, select candidate + if ($minPriority < $candidatePriority && $candidatePriority < $currentPriority) { + $package = $candidate; + continue; + } + + // candidate is more stable than our preferred stability, + // and current package is less stable than preferred stability, select candidate if ($minPriority >= $candidatePriority && $minPriority < $currentPriority) { $package = $candidate; continue;