diff vendor/composer/semver/src/VersionParser.php @ 18:af1871eacc83

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:33:08 +0100
parents 4c8ae668cc8c
children
line wrap: on
line diff
--- a/vendor/composer/semver/src/VersionParser.php	Thu Feb 28 13:21:36 2019 +0000
+++ b/vendor/composer/semver/src/VersionParser.php	Thu May 09 15:33:08 2019 +0100
@@ -322,11 +322,11 @@
             }
 
             // Work out which position in the version we are operating at
-            if (isset($matches[4]) && '' !== $matches[4]) {
+            if (isset($matches[4]) && '' !== $matches[4] && null !== $matches[4]) {
                 $position = 4;
-            } elseif (isset($matches[3]) && '' !== $matches[3]) {
+            } elseif (isset($matches[3]) && '' !== $matches[3] && null !== $matches[3]) {
                 $position = 3;
-            } elseif (isset($matches[2]) && '' !== $matches[2]) {
+            } elseif (isset($matches[2]) && '' !== $matches[2] && null !== $matches[2]) {
                 $position = 2;
             } else {
                 $position = 1;
@@ -334,19 +334,11 @@
 
             // Calculate the stability suffix
             $stabilitySuffix = '';
-            if (!empty($matches[5])) {
-                $stabilitySuffix .= '-' . $this->expandStability($matches[5]) . (!empty($matches[6]) ? $matches[6] : '');
-            }
-
-            if (!empty($matches[7])) {
+            if (empty($matches[5]) && empty($matches[7])) {
                 $stabilitySuffix .= '-dev';
             }
 
-            if (!$stabilitySuffix) {
-                $stabilitySuffix = '-dev';
-            }
-
-            $lowVersion = $this->manipulateVersionString($matches, $position, 0) . $stabilitySuffix;
+            $lowVersion = $this->normalize(substr($constraint . $stabilitySuffix, 1));
             $lowerBound = new Constraint('>=', $lowVersion);
 
             // For upper bound, we increment the position of one more significance,
@@ -368,9 +360,9 @@
         // versions 0.X >=0.1.0, and no updates for versions 0.0.X
         if (preg_match('{^\^' . $versionRegex . '($)}i', $constraint, $matches)) {
             // Work out which position in the version we are operating at
-            if ('0' !== $matches[1] || '' === $matches[2]) {
+            if ('0' !== $matches[1] || '' === $matches[2] || null === $matches[2]) {
                 $position = 1;
-            } elseif ('0' !== $matches[2] || '' === $matches[3]) {
+            } elseif ('0' !== $matches[2] || '' === $matches[3] || null === $matches[3]) {
                 $position = 2;
             } else {
                 $position = 3;
@@ -401,9 +393,9 @@
         // Any of X, x, or * may be used to "stand in" for one of the numeric values in the [major, minor, patch] tuple.
         // A partial version range is treated as an X-Range, so the special character is in fact optional.
         if (preg_match('{^v?(\d++)(?:\.(\d++))?(?:\.(\d++))?(?:\.[xX*])++$}', $constraint, $matches)) {
-            if (isset($matches[3]) && '' !== $matches[3]) {
+            if (isset($matches[3]) && '' !== $matches[3] && null !== $matches[3]) {
                 $position = 3;
-            } elseif (isset($matches[2]) && '' !== $matches[2]) {
+            } elseif (isset($matches[2]) && '' !== $matches[2] && null !== $matches[2]) {
                 $position = 2;
             } else {
                 $position = 1;