From 574003db031f41aeb12a3cb47b14c3b3794a8770 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Wed, 30 Mar 2022 18:09:40 +0200 Subject: [PATCH] Fix parsing of openssl versions with odd suffixes, refs #10631 --- src/Composer/Platform/Version.php | 2 +- tests/Composer/Test/Platform/VersionTest.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Composer/Platform/Version.php b/src/Composer/Platform/Version.php index ef9de137ed34..053ca716bc27 100644 --- a/src/Composer/Platform/Version.php +++ b/src/Composer/Platform/Version.php @@ -28,7 +28,7 @@ public static function parseOpenssl(string $opensslVersion, ?bool &$isFips): ?st { $isFips = false; - if (!Preg::isMatch('/^(?[0-9.]+)(?[a-z]{0,2})?(?(?:-?(?:dev|pre|alpha|beta|rc|fips)[\d]*)*)?(?-\w+)?$/', $opensslVersion, $matches)) { + if (!Preg::isMatch('/^(?[0-9.]+)(?[a-z]{0,2})?(?(?:-?(?:dev|pre|alpha|beta|rc|fips)[\d]*)*)?(?-\w+)?(? \(.+?\))?$/', $opensslVersion, $matches)) { return null; } diff --git a/tests/Composer/Test/Platform/VersionTest.php b/tests/Composer/Test/Platform/VersionTest.php index 09478933a6ba..d709bd1ab03d 100644 --- a/tests/Composer/Test/Platform/VersionTest.php +++ b/tests/Composer/Test/Platform/VersionTest.php @@ -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'),