mirror of
https://github.com/danog/phpseclib.git
synced 2024-12-11 08:39:43 +01:00
BigInteger: tweak to the phpinfo checks
This commit is contained in:
parent
59481054df
commit
c22bf62ce1
@ -257,25 +257,28 @@ class Math_BigInteger
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (function_exists('phpinfo') && extension_loaded('openssl') && !defined('MATH_BIGINTEGER_OPENSSL_DISABLE') && !defined('MATH_BIGINTEGER_OPENSSL_ENABLED')) {
|
if (extension_loaded('openssl') && !defined('MATH_BIGINTEGER_OPENSSL_DISABLE') && !defined('MATH_BIGINTEGER_OPENSSL_ENABLED')) {
|
||||||
// some versions of XAMPP have mismatched versions of OpenSSL which causes it not to work
|
|
||||||
ob_start();
|
|
||||||
@phpinfo();
|
|
||||||
$content = ob_get_contents();
|
|
||||||
ob_end_clean();
|
|
||||||
|
|
||||||
preg_match_all('#OpenSSL (Header|Library) Version(.*)#im', $content, $matches);
|
|
||||||
|
|
||||||
$versions = array();
|
$versions = array();
|
||||||
if (!empty($matches[1])) {
|
|
||||||
for ($i = 0; $i < count($matches[1]); $i++) {
|
|
||||||
$fullVersion = trim(str_replace('=>', '', strip_tags($matches[2][$i])));
|
|
||||||
|
|
||||||
// Remove letter part in OpenSSL version
|
if (function_exists('phpinfo')) {
|
||||||
if (!preg_match('/(\d+\.\d+\.\d+)/i', $fullVersion, $m)) {
|
// some versions of XAMPP have mismatched versions of OpenSSL which causes it not to work
|
||||||
$versions[$matches[1][$i]] = $fullVersion;
|
ob_start();
|
||||||
} else {
|
@phpinfo();
|
||||||
$versions[$matches[1][$i]] = $m[0];
|
$content = ob_get_contents();
|
||||||
|
ob_end_clean();
|
||||||
|
|
||||||
|
preg_match_all('#OpenSSL (Header|Library) Version(.*)#im', $content, $matches);
|
||||||
|
|
||||||
|
if (!empty($matches[1])) {
|
||||||
|
for ($i = 0; $i < count($matches[1]); $i++) {
|
||||||
|
$fullVersion = trim(str_replace('=>', '', strip_tags($matches[2][$i])));
|
||||||
|
|
||||||
|
// Remove letter part in OpenSSL version
|
||||||
|
if (!preg_match('/(\d+\.\d+\.\d+)/i', $fullVersion, $m)) {
|
||||||
|
$versions[$matches[1][$i]] = $fullVersion;
|
||||||
|
} else {
|
||||||
|
$versions[$matches[1][$i]] = $m[0];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user