Browse Source

Fix parsing of stability for lowercased RC versions

Jordi Boggiano 12 years ago
parent
commit
e01a9c564d

+ 2 - 2
src/Composer/Package/Version/VersionParser.php

@@ -41,7 +41,7 @@ class VersionParser
             return 'dev';
         }
 
-        preg_match('{'.self::$modifierRegex.'$}', $version, $match);
+        preg_match('{'.self::$modifierRegex.'$}i', strtolower($version), $match);
         if (!empty($match[3])) {
             return 'dev';
         }
@@ -53,7 +53,7 @@ class VersionParser
             if ('alpha' === $match[1] || 'a' === $match[1]) {
                 return 'alpha';
             }
-            if ('RC' === $match[1]) {
+            if ('rc' === $match[1]) {
                 return 'RC';
             }
         }

+ 2 - 1
tests/Composer/Test/Package/Version/VersionParserTest.php

@@ -240,9 +240,10 @@ class VersionParserTest extends \PHPUnit_Framework_TestCase
             array('stable', '3.1.2-patch'),
             array('alpha',  '3.1.2-alpha5'),
             array('beta',   '3.1.2-beta'),
-            array('beta',   '2.0b1'),
+            array('beta',   '2.0B1'),
             array('alpha',  '1.2.0a1'),
             array('alpha',  '1.2_a1'),
+            array('RC',     '2.0.0rc1')
         );
     }
 }