From dd49db6f0864197b00c92e662f0d1ca8364e076a Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Sun, 5 Sep 2021 09:56:28 +0200 Subject: [PATCH] Make sure that names with wildcards which are not preceded by dots are also seen as package names and not version constraints --- src/Composer/Package/Version/VersionParser.php | 2 +- tests/Composer/Test/Package/Version/VersionParserTest.php | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Composer/Package/Version/VersionParser.php b/src/Composer/Package/Version/VersionParser.php index e956af145..df3e9feb2 100644 --- a/src/Composer/Package/Version/VersionParser.php +++ b/src/Composer/Package/Version/VersionParser.php @@ -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('{(? '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' => '*'))), ); }