1
0
Fork 0

Fix parsing stability suffixes in multi constraints, fixes #1732

pull/3517/head
Jordi Boggiano 2014-12-07 17:46:04 +00:00
parent eb1ce550ca
commit 029f709300
2 changed files with 15 additions and 1 deletions

View File

@ -360,7 +360,7 @@ class VersionParser
if (!empty($stabilityModifier) && $this->parseStability($version) === 'stable') {
$version .= '-' . $stabilityModifier;
} elseif ('<' === $matches[1]) {
if (!preg_match('/-stable$/', strtolower($matches[2]))) {
if (!preg_match('/-' . self::$modifierRegex . '$/', strtolower($matches[2]))) {
$version .= '-dev';
}
}

View File

@ -300,6 +300,20 @@ class VersionParserTest extends \PHPUnit_Framework_TestCase
$this->assertSame((string) $multi, (string) $parser->parseConstraints('>2.0,<=3.0'));
}
public function testParseConstraintsMultiWithStabilitySuffix()
{
$parser = new VersionParser;
$first = new VersionConstraint('>=', '1.1.0.0-alpha4');
$second = new VersionConstraint('<', '1.2.9999999.9999999-dev');
$multi = new MultiConstraint(array($first, $second));
$this->assertSame((string) $multi, (string) $parser->parseConstraints('>=1.1.0-alpha4,<1.2.x-dev'));
$first = new VersionConstraint('>=', '1.1.0.0-alpha4');
$second = new VersionConstraint('<', '1.2.0.0-beta2');
$multi = new MultiConstraint(array($first, $second));
$this->assertSame((string) $multi, (string) $parser->parseConstraints('>=1.1.0-alpha4,<1.2-beta2'));
}
public function testParseConstraintsMultiDisjunctiveHasPrioOverConjuctive()
{
$parser = new VersionParser;