Merge pull request #4875 from cs278/openssl-platform-version
Handle OpenSSL's many patch releasespull/4883/head
commit
2e1cdccac0
|
@ -114,6 +114,7 @@ class PlatformRepository extends ArrayRepository
|
||||||
// relying on them.
|
// relying on them.
|
||||||
foreach ($loadedExtensions as $name) {
|
foreach ($loadedExtensions as $name) {
|
||||||
$prettyVersion = null;
|
$prettyVersion = null;
|
||||||
|
$description = 'The '.$name.' PHP library';
|
||||||
switch ($name) {
|
switch ($name) {
|
||||||
case 'curl':
|
case 'curl':
|
||||||
$curlVersion = curl_version();
|
$curlVersion = curl_version();
|
||||||
|
@ -146,9 +147,27 @@ class PlatformRepository extends ArrayRepository
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'openssl':
|
case 'openssl':
|
||||||
$prettyVersion = preg_replace_callback('{^(?:OpenSSL\s*)?([0-9.]+)([a-z]?).*}', function ($match) {
|
$prettyVersion = preg_replace_callback('{^(?:OpenSSL\s*)?([0-9.]+)([a-z]*).*}', function ($match) {
|
||||||
return $match[1] . (empty($match[2]) ? '' : '.'.(ord($match[2]) - 96));
|
if (empty($match[2])) {
|
||||||
|
return $match[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
// OpenSSL versions add another letter when they reach Z.
|
||||||
|
// e.g. OpenSSL 0.9.8zh 3 Dec 2015
|
||||||
|
|
||||||
|
if (!preg_match('{^z*[a-z]$}', $match[2])) {
|
||||||
|
// 0.9.8abc is garbage
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$len = strlen($match[2]);
|
||||||
|
$patchVersion = ($len - 1) * 26; // All Z
|
||||||
|
$patchVersion += ord($match[2][$len - 1]) - 96;
|
||||||
|
|
||||||
|
return $match[1].'.'.$patchVersion;
|
||||||
}, OPENSSL_VERSION_TEXT);
|
}, OPENSSL_VERSION_TEXT);
|
||||||
|
|
||||||
|
$description = OPENSSL_VERSION_TEXT;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'pcre':
|
case 'pcre':
|
||||||
|
@ -175,7 +194,7 @@ class PlatformRepository extends ArrayRepository
|
||||||
}
|
}
|
||||||
|
|
||||||
$lib = new CompletePackage('lib-'.$name, $version, $prettyVersion);
|
$lib = new CompletePackage('lib-'.$name, $version, $prettyVersion);
|
||||||
$lib->setDescription('The '.$name.' PHP library');
|
$lib->setDescription($description);
|
||||||
$this->addPackage($lib);
|
$this->addPackage($lib);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue