mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-12-27 11:52:48 +00:00
Move JIT check to BigInteger
This commit is contained in:
parent
866cc78fbd
commit
e113bb35e7
@ -29,6 +29,7 @@ namespace phpseclib3\Math;
|
||||
|
||||
use phpseclib3\Exception\BadConfigurationException;
|
||||
use phpseclib3\Math\BigInteger\Engines\Engine;
|
||||
use UnexpectedValueException;
|
||||
|
||||
/**
|
||||
* Pure-PHP arbitrary precision integer arithmetic library. Supports base-2, base-10, base-16, and base-256
|
||||
@ -135,6 +136,16 @@ class BigInteger implements \JsonSerializable
|
||||
private static function initialize_static_variables()
|
||||
{
|
||||
if (!isset(self::$mainEngine)) {
|
||||
// see https://github.com/php/php-src/issues/11917
|
||||
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN' && function_exists('opcache_get_status') && !defined('PHPSECLIB_ALLOW_JIT')) {
|
||||
$status = opcache_get_status();
|
||||
if ($status && isset($status['jit']) && $status['jit']['enabled'] && $status['jit']['on']) {
|
||||
throw new UnexpectedValueException(
|
||||
'JIT on Windows is not currently supported'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$engines = [
|
||||
['GMP', ['DefaultEngine']],
|
||||
['PHP64', ['OpenSSL']],
|
||||
|
@ -19,14 +19,4 @@ if (extension_loaded('mbstring')) {
|
||||
'is not supported by phpseclib.'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// see https://github.com/php/php-src/issues/11917
|
||||
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN' && function_exists('opcache_get_status') && !defined('PHPSECLIB_ALLOW_JIT')) {
|
||||
$status = opcache_get_status();
|
||||
if ($status && isset($status['jit']) && $status['jit']['enabled'] && $status['jit']['on']) {
|
||||
throw new UnexpectedValueException(
|
||||
'JIT on Windows is not currently supported'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user