diff --git a/src/Composer/Platform/Version.php b/src/Composer/Platform/Version.php index 61b3b5669..a55266c86 100644 --- a/src/Composer/Platform/Version.php +++ b/src/Composer/Platform/Version.php @@ -26,7 +26,7 @@ class Version { $isFips = false; - if (!preg_match('/^(?[0-9.]+)(?[a-z]{0,2})?(?(?:-?(?:dev|pre|alpha|beta|rc|fips)[\d]*)*)?$/', $opensslVersion, $matches)) { + if (!preg_match('/^(?[0-9.]+)(?[a-z]{0,2})?(?(?:-?(?:dev|pre|alpha|beta|rc|fips)[\d]*)*)?(?-\w+)?$/', $opensslVersion, $matches)) { return null; } diff --git a/tests/Composer/Test/Repository/PlatformRepositoryTest.php b/tests/Composer/Test/Repository/PlatformRepositoryTest.php index faec2f8d5..e2ba60806 100644 --- a/tests/Composer/Test/Repository/PlatformRepositoryTest.php +++ b/tests/Composer/Test/Repository/PlatformRepositoryTest.php @@ -775,6 +775,13 @@ msgpack support => yes', array(), array(array('OPENSSL_VERSION_TEXT', null, 'OpenSSL 1.1.1g 21 Apr 2020')), ), + 'openssl: distro peculiarities' => array( + 'openssl', + null, + array('lib-openssl' => '1.1.1.7'), + array(), + array(array('OPENSSL_VERSION_TEXT', null, 'OpenSSL 1.1.1g-freebsd 21 Apr 2020')), + ), 'openssl: two letters suffix' => array( 'openssl', null,