From 83792838c954d713bf9773e43ab4baf379aaaa59 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Wed, 30 Aug 2023 10:45:57 +0200 Subject: [PATCH] Fix problem output bug when purely numeric versions are condensed --- src/Composer/DependencyResolver/Problem.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Composer/DependencyResolver/Problem.php b/src/Composer/DependencyResolver/Problem.php index 21b76ec3a..cf2cb381e 100644 --- a/src/Composer/DependencyResolver/Problem.php +++ b/src/Composer/DependencyResolver/Problem.php @@ -453,7 +453,7 @@ class Problem } /** - * @param array $versions an array of pretty versions, with normalized versions as keys + * @param array $versions an array of pretty versions, with normalized versions as keys * @return list a list of pretty versions and '...' where versions were removed */ private static function condenseVersionList(array $versions, int $max, int $maxDev = 16): array @@ -465,10 +465,10 @@ class Problem $filtered = []; $byMajor = []; foreach ($versions as $version => $pretty) { - if (0 === stripos($version, 'dev-')) { + if (0 === stripos((string) $version, 'dev-')) { $byMajor['dev'][] = $pretty; } else { - $byMajor[Preg::replace('{^(\d+)\..*}', '$1', $version)][] = $pretty; + $byMajor[Preg::replace('{^(\d+)\..*}', '$1', (string) $version)][] = $pretty; } } foreach ($byMajor as $majorVersion => $versionsForMajor) {