Skip to content

Commit

Permalink
Fix parsing of openssl versions with odd suffixes, refs composer#10631
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek authored and emahorvat52 committed Jan 18, 2023
1 parent 43ebcb5 commit 574003d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Composer/Platform/Version.php
Expand Up @@ -28,7 +28,7 @@ public static function parseOpenssl(string $opensslVersion, ?bool &$isFips): ?st
{
$isFips = false;

if (!Preg::isMatch('/^(?<version>[0-9.]+)(?<patch>[a-z]{0,2})?(?<suffix>(?:-?(?:dev|pre|alpha|beta|rc|fips)[\d]*)*)?(?<garbage>-\w+)?$/', $opensslVersion, $matches)) {
if (!Preg::isMatch('/^(?<version>[0-9.]+)(?<patch>[a-z]{0,2})?(?<suffix>(?:-?(?:dev|pre|alpha|beta|rc|fips)[\d]*)*)?(?<garbage>-\w+)?(?<garbage2> \(.+?\))?$/', $opensslVersion, $matches)) {
return null;
}

Expand Down
1 change: 1 addition & 0 deletions tests/Composer/Test/Platform/VersionTest.php
Expand Up @@ -62,6 +62,7 @@ public static function provideOpenSslVersions(): array
// Additional cases
array('1.2.3zh-fips-rc3', '1.2.3.34-rc3', true, '1.2.3.34-RC3'),
array('1.2.3zh-alpha10-fips', '1.2.3.34-alpha10', true),
array('1.1.1l (Schannel)', '1.1.1.12'),
// Check that alphabetical patch levels overflow correctly
array('1.2.3', '1.2.3.0'),
array('1.2.3a', '1.2.3.1'),
Expand Down

0 comments on commit 574003d

Please sign in to comment.