Make sure that names with wildcards which are not preceded by dots are also seen as package names and not version constraints
parent
6c9aecf4e7
commit
dd49db6f08
|
@ -51,7 +51,7 @@ class VersionParser extends SemverVersionParser
|
|||
|
||||
for ($i = 0, $count = count($pairs); $i < $count; $i++) {
|
||||
$pair = preg_replace('{^([^=: ]+)[=: ](.*)$}', '$1 $2', trim($pairs[$i]));
|
||||
if (false === strpos($pair, ' ') && isset($pairs[$i + 1]) && false === strpos($pairs[$i + 1], '/') && !preg_match('{(?<!\.)\*}', $pairs[$i + 1]) && !PlatformRepository::isPlatformPackage($pairs[$i + 1])) {
|
||||
if (false === strpos($pair, ' ') && isset($pairs[$i + 1]) && false === strpos($pairs[$i + 1], '/') && !preg_match('{(?<=[a-z0-9_/-])\*|\*(?=[a-z0-9_/-])}i', $pairs[$i + 1]) && !PlatformRepository::isPlatformPackage($pairs[$i + 1])) {
|
||||
$pair .= ' '.$pairs[$i + 1];
|
||||
$i++;
|
||||
}
|
||||
|
|
|
@ -33,6 +33,8 @@ class VersionParserTest extends TestCase
|
|||
array(array('php:^7.0'), array(array('name' => 'php', 'version' => '^7.0'))),
|
||||
array(array('php', '^7.0'), array(array('name' => 'php', 'version' => '^7.0'))),
|
||||
array(array('php', 'ext-apcu'), array(array('name' => 'php'), array('name' => 'ext-apcu'))),
|
||||
array(array('foo/*', 'bar*', 'acme/baz', '*@dev'), array(array('name' => 'foo/*'), array('name' => 'bar*'), array('name' => 'acme/baz', 'version' => '*@dev'))),
|
||||
array(array('php', '*'), array(array('name' => 'php', 'version' => '*'))),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue