From 908d2d91da8425cd731c55328e0f299c0ae96d06 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Mon, 11 Feb 2013 11:52:50 +0100 Subject: [PATCH] Fix case insensitive matching --- composer.lock | 90 +++++++++---------- .../Package/Version/VersionParser.php | 2 +- .../Package/Version/VersionParserTest.php | 1 + 3 files changed, 47 insertions(+), 46 deletions(-) diff --git a/composer.lock b/composer.lock index 95a7c2db5..e2a1c6b6f 100644 --- a/composer.lock +++ b/composer.lock @@ -68,8 +68,8 @@ "description": "JSON Linter", "keywords": [ "json", - "parser", "linter", + "parser", "validator" ] }, @@ -80,22 +80,22 @@ "source": { "type": "git", "url": "https://github.com/symfony/Console", - "reference": "v2.2.0-BETA1" + "reference": "f65e34d058f0990a724f78e8d091dc0a20e439ac" }, "dist": { "type": "zip", - "url": "https://github.com/symfony/Console/archive/v2.2.0-BETA1.zip", - "reference": "v2.2.0-BETA1", + "url": "https://api.github.com/repos/symfony/Console/zipball/f65e34d058f0990a724f78e8d091dc0a20e439ac", + "reference": "f65e34d058f0990a724f78e8d091dc0a20e439ac", "shasum": "" }, "require": { "php": ">=5.3.3" }, - "time": "2013-01-08 18:17:41", + "time": "2013-01-31 21:39:01", "type": "library", "extra": { "branch-alias": { - "dev-master": "2.2-dev" + "dev-master": "2.3-dev" } }, "autoload": { @@ -122,23 +122,23 @@ }, { "name": "symfony/finder", - "version": "v2.1.6", + "version": "v2.1.7", "target-dir": "Symfony/Component/Finder", "source": { "type": "git", "url": "https://github.com/symfony/Finder", - "reference": "v2.1.6" + "reference": "v2.1.7" }, "dist": { "type": "zip", - "url": "https://github.com/symfony/Finder/archive/v2.1.6.zip", - "reference": "v2.1.6", + "url": "https://github.com/symfony/Finder/archive/v2.1.7.zip", + "reference": "v2.1.7", "shasum": "" }, "require": { "php": ">=5.3.3" }, - "time": "2012-12-10 12:46:54", + "time": "2013-01-09 08:51:07", "type": "library", "autoload": { "psr-0": { @@ -169,22 +169,22 @@ "source": { "type": "git", "url": "https://github.com/symfony/Process", - "reference": "v2.2.0-BETA1" + "reference": "c99475d555934461f079521d024d88a0d4e861eb" }, "dist": { "type": "zip", - "url": "https://github.com/symfony/Process/archive/v2.2.0-BETA1.zip", - "reference": "v2.2.0-BETA1", + "url": "https://api.github.com/repos/symfony/Process/zipball/c99475d555934461f079521d024d88a0d4e861eb", + "reference": "c99475d555934461f079521d024d88a0d4e861eb", "shasum": "" }, "require": { "php": ">=5.3.3" }, - "time": "2013-01-05 18:24:35", + "time": "2013-01-31 21:39:01", "type": "library", "extra": { "branch-alias": { - "dev-master": "2.2-dev" + "dev-master": "2.3-dev" } }, "autoload": { @@ -228,8 +228,8 @@ "require": { "php": ">=5.3.3", "phpunit/php-file-iterator": ">=1.3.0@stable", - "phpunit/php-token-stream": ">=1.1.3@stable", - "phpunit/php-text-template": ">=1.1.1@stable" + "phpunit/php-text-template": ">=1.1.1@stable", + "phpunit/php-token-stream": ">=1.1.3@stable" }, "suggest": { "ext-dom": "*", @@ -259,8 +259,8 @@ "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", "homepage": "https://github.com/sebastianbergmann/php-code-coverage", "keywords": [ - "testing", "coverage", + "testing", "xunit" ] }, @@ -444,38 +444,38 @@ }, { "name": "phpunit/phpunit", - "version": "3.7.12", + "version": "3.7.13", "source": { "type": "git", "url": "git://github.com/sebastianbergmann/phpunit.git", - "reference": "3.7.12" + "reference": "3.7.13" }, "dist": { "type": "zip", - "url": "https://github.com/sebastianbergmann/phpunit/archive/3.7.12.zip", - "reference": "3.7.12", + "url": "https://github.com/sebastianbergmann/phpunit/archive/3.7.13.zip", + "reference": "3.7.13", "shasum": "" }, "require": { - "php": ">=5.3.3", - "phpunit/php-file-iterator": ">=1.3.1", - "phpunit/php-text-template": ">=1.1.1", - "phpunit/php-code-coverage": ">=1.2.1", - "phpunit/php-timer": ">=1.0.2", - "phpunit/phpunit-mock-objects": ">=1.2.0,<1.3.0", - "symfony/yaml": ">=2.1.0,<2.2.0", "ext-dom": "*", "ext-pcre": "*", "ext-reflection": "*", - "ext-spl": "*" + "ext-spl": "*", + "php": ">=5.3.3", + "phpunit/php-code-coverage": ">=1.2.1", + "phpunit/php-file-iterator": ">=1.3.1", + "phpunit/php-text-template": ">=1.1.1", + "phpunit/php-timer": ">=1.0.2", + "phpunit/phpunit-mock-objects": ">=1.2.0,<1.3.0", + "symfony/yaml": ">=2.1.0,<2.2.0" }, "suggest": { - "phpunit/php-invoker": ">=1.1.0", "ext-json": "*", "ext-simplexml": "*", - "ext-tokenizer": "*" + "ext-tokenizer": "*", + "phpunit/php-invoker": ">=1.1.0" }, - "time": "2013-01-09 22:41:02", + "time": "2013-01-13 10:21:19", "bin": [ "composer/bin/phpunit" ], @@ -508,23 +508,23 @@ "description": "The PHP Unit Testing framework.", "homepage": "http://www.phpunit.de/", "keywords": [ - "testing", "phpunit", + "testing", "xunit" ] }, { "name": "phpunit/phpunit-mock-objects", - "version": "1.2.2", + "version": "1.2.3", "source": { "type": "git", "url": "git://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "1.2.2" + "reference": "1.2.3" }, "dist": { "type": "zip", - "url": "https://github.com/sebastianbergmann/phpunit-mock-objects/archive/1.2.2.zip", - "reference": "1.2.2", + "url": "https://github.com/sebastianbergmann/phpunit-mock-objects/archive/1.2.3.zip", + "reference": "1.2.3", "shasum": "" }, "require": { @@ -534,7 +534,7 @@ "suggest": { "ext-soap": "*" }, - "time": "2012-11-05 10:39:13", + "time": "2013-01-13 10:24:48", "type": "library", "autoload": { "classmap": [ @@ -564,23 +564,23 @@ }, { "name": "symfony/yaml", - "version": "v2.1.6", + "version": "v2.1.7", "target-dir": "Symfony/Component/Yaml", "source": { "type": "git", "url": "https://github.com/symfony/Yaml", - "reference": "v2.1.6" + "reference": "v2.1.7" }, "dist": { "type": "zip", - "url": "https://github.com/symfony/Yaml/archive/v2.1.6.zip", - "reference": "v2.1.6", + "url": "https://api.github.com/repos/symfony/Yaml/zipball/v2.1.7", + "reference": "v2.1.7", "shasum": "" }, "require": { "php": ">=5.3.3" }, - "time": "2012-12-06 10:00:55", + "time": "2013-01-17 21:21:51", "type": "library", "autoload": { "psr-0": { diff --git a/src/Composer/Package/Version/VersionParser.php b/src/Composer/Package/Version/VersionParser.php index 8d0d4d0f2..fbedc9e33 100644 --- a/src/Composer/Package/Version/VersionParser.php +++ b/src/Composer/Package/Version/VersionParser.php @@ -256,7 +256,7 @@ class VersionParser return array(); } - if (preg_match('{^~(\d+)(?:\.(\d+))?(?:\.(\d+))?(?:\.(\d+))?'.self::$modifierRegex.'?$}', $constraint, $matches)) { + if (preg_match('{^~(\d+)(?:\.(\d+))?(?:\.(\d+))?(?:\.(\d+))?'.self::$modifierRegex.'?$}i', $constraint, $matches)) { if (isset($matches[4]) && '' !== $matches[4]) { $highVersion = $matches[1] . '.' . $matches[2] . '.' . ($matches[3] + 1) . '.0-dev'; $lowVersion = $matches[1] . '.' . $matches[2] . '.' . $matches[3]. '.' . $matches[4]; diff --git a/tests/Composer/Test/Package/Version/VersionParserTest.php b/tests/Composer/Test/Package/Version/VersionParserTest.php index c115a4e22..d62a8df5c 100644 --- a/tests/Composer/Test/Package/Version/VersionParserTest.php +++ b/tests/Composer/Test/Package/Version/VersionParserTest.php @@ -265,6 +265,7 @@ class VersionParserTest extends \PHPUnit_Framework_TestCase array('~1.2.3.4', new VersionConstraint('>=', '1.2.3.4'), new VersionConstraint('<', '1.2.4.0-dev')), array('~1.2-beta',new VersionConstraint('>=', '1.2.0.0-beta'), new VersionConstraint('<', '2.0.0.0-dev')), array('~1.2-b2', new VersionConstraint('>=', '1.2.0.0-beta2'), new VersionConstraint('<', '2.0.0.0-dev')), + array('~1.2-BETA2', new VersionConstraint('>=', '1.2.0.0-beta2'), new VersionConstraint('<', '2.0.0.0-dev')), array('~1.2.2-dev', new VersionConstraint('>=', '1.2.2.0-dev'), new VersionConstraint('<', '1.3.0.0-dev')), ); }