1
0
Fork 0

Parse openssl 3 versions cleaner

pull/10818/head
Jordi Boggiano 2022-06-02 21:15:18 +02:00
parent 3ead6c0119
commit 15f7d24e7e
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
2 changed files with 10 additions and 2 deletions

View File

@ -32,11 +32,16 @@ class Version
return null;
}
// OpenSSL 1 used 1.2.3a style versioning, 3+ uses semver
$patch = '';
if (version_compare($matches['version'], '3.0.0', '<')) {
$patch = '.'.self::convertAlphaVersionToIntVersion($matches['patch']);
}
$isFips = strpos($matches['suffix'], 'fips') !== false;
$suffix = strtr('-'.ltrim($matches['suffix'], '-'), array('-fips' => '', '-pre' => '-alpha'));
$patch = self::convertAlphaVersionToIntVersion($matches['patch']);
return rtrim($matches['version'].'.'.$patch.$suffix, '-');
return rtrim($matches['version'].$patch.$suffix, '-');
}
/**

View File

@ -69,6 +69,9 @@ class VersionTest extends TestCase
array('1.2.3za', '1.2.3.27'),
array('1.2.3zy', '1.2.3.51'),
array('1.2.3zz', '1.2.3.52'),
// 3.x
array('3.0.0', '3.0.0', false, '3.0.0.0'),
array('3.2.4-dev', '3.2.4-dev', false, '3.2.4.0-dev'),
);
}