1
0
Fork 0
mirror of https://github.com/composer/composer synced 2025-05-11 01:22:54 +00:00

Fix support for versions with 4 components in VersionSelector, fixes #11716

This commit is contained in:
Jordi Boggiano 2024-01-08 14:56:08 +01:00
parent 12ed21705d
commit be71bf056e
No known key found for this signature in database
GPG key ID: 7BBD42C429EC80BC
2 changed files with 5 additions and 1 deletions

View file

@ -182,6 +182,7 @@ class VersionSelector
*
* For example:
* * 1.2.1 -> ^1.2
* * 1.2.1.2 -> ^1.2
* * 1.2 -> ^1.2
* * v3.2.1 -> ^3.2
* * 2.0-beta.1 -> ^2.0@beta
@ -227,7 +228,7 @@ class VersionSelector
$semanticVersionParts = explode('.', $version);
// check to see if we have a semver-looking version
if (count($semanticVersionParts) === 4 && Preg::isMatch('{^0\D?}', $semanticVersionParts[3])) {
if (count($semanticVersionParts) === 4 && Preg::isMatch('{^\d+\D?}', $semanticVersionParts[3])) {
// remove the last parts (i.e. the patch version number and any extra)
if ($semanticVersionParts[0] === '0') {
unset($semanticVersionParts[3]);