From 267af928df41085ef2390d686d245614bf2f6f80 Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Mon, 22 Dec 2014 12:22:29 +0100 Subject: [PATCH 1/2] Add a failing testcase for stability flags in complex constraints Refs #3570 --- tests/Composer/Test/Package/Loader/RootPackageLoaderTest.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/Composer/Test/Package/Loader/RootPackageLoaderTest.php b/tests/Composer/Test/Package/Loader/RootPackageLoaderTest.php index 51799d053..d1f3be1f8 100644 --- a/tests/Composer/Test/Package/Loader/RootPackageLoaderTest.php +++ b/tests/Composer/Test/Package/Loader/RootPackageLoaderTest.php @@ -143,6 +143,7 @@ class RootPackageLoaderTest extends \PHPUnit_Framework_TestCase 'foo/bar' => '~2.1.0-beta2', 'bar/baz' => '1.0.x-dev as 1.2.0', 'qux/quux' => '1.0.*@rc', + 'zux/complex' => '~1.0,>=1.0.2@dev' ), 'minimum-stability' => 'alpha', )); @@ -151,6 +152,7 @@ class RootPackageLoaderTest extends \PHPUnit_Framework_TestCase $this->assertEquals(array( 'bar/baz' => BasePackage::STABILITY_DEV, 'qux/quux' => BasePackage::STABILITY_RC, + 'zux/complex' => BasePackage::STABILITY_DEV, ), $package->getStabilityFlags()); } } From d8813341c3fb0026c130f2d4e153e4954906f861 Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Mon, 22 Dec 2014 12:31:34 +0100 Subject: [PATCH 2/2] Support parsing stability flags on complex constraints Fixes #3570 --- src/Composer/Package/Loader/RootPackageLoader.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Composer/Package/Loader/RootPackageLoader.php b/src/Composer/Package/Loader/RootPackageLoader.php index 64880d727..250f2952f 100644 --- a/src/Composer/Package/Loader/RootPackageLoader.php +++ b/src/Composer/Package/Loader/RootPackageLoader.php @@ -131,7 +131,7 @@ class RootPackageLoader extends ArrayLoader $minimumStability = $stabilities[$minimumStability]; foreach ($requires as $reqName => $reqVersion) { // parse explicit stability flags to the most unstable - if (preg_match('{^[^,\s]*?@('.implode('|', array_keys($stabilities)).')$}i', $reqVersion, $match)) { + if (preg_match('{^[^@]*?@('.implode('|', array_keys($stabilities)).')$}i', $reqVersion, $match)) { $name = strtolower($reqName); $stability = $stabilities[VersionParser::normalizeStability($match[1])];