Parse openssl 3 versions cleaner
parent
3ead6c0119
commit
15f7d24e7e
|
@ -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, '-');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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'),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue