Skip to content

Commit

Permalink
Fix lib-openssl detection on FreeBSD, fixes #10046
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek committed Aug 19, 2021
1 parent 9727adf commit 74b231a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Composer/Platform/Version.php
Expand Up @@ -26,7 +26,7 @@ public static function parseOpenssl($opensslVersion, &$isFips)
{
$isFips = false;

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

Expand Down
7 changes: 7 additions & 0 deletions tests/Composer/Test/Repository/PlatformRepositoryTest.php
Expand Up @@ -775,6 +775,13 @@ public static function getLibraryTestCases()
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,
Expand Down

0 comments on commit 74b231a

Please sign in to comment.