diff options
Diffstat (limited to 'lib/random.php')
-rw-r--r-- | lib/random.php | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/random.php b/lib/random.php index 7171460..c3dacb7 100644 --- a/lib/random.php +++ b/lib/random.php @@ -53,7 +53,7 @@ if (PHP_VERSION_ID < 70000) { require_once $RandomCompatDIR.'/cast_to_int.php'; require_once $RandomCompatDIR.'/error_polyfill.php'; - if (!function_exists('random_bytes')) { + if (!is_callable('random_bytes')) { /** * PHP 5.2.0 - 5.6.x way to implement random_bytes() * @@ -71,7 +71,7 @@ if (PHP_VERSION_ID < 70000) { */ if (extension_loaded('libsodium')) { // See random_bytes_libsodium.php - if (PHP_VERSION_ID >= 50300 && function_exists('\\Sodium\\randombytes_buf')) { + if (PHP_VERSION_ID >= 50300 && is_callable('\\Sodium\\randombytes_buf')) { require_once $RandomCompatDIR.'/random_bytes_libsodium.php'; } elseif (method_exists('Sodium', 'randombytes_buf')) { require_once $RandomCompatDIR.'/random_bytes_libsodium_legacy.php'; @@ -100,7 +100,7 @@ if (PHP_VERSION_ID < 70000) { } if ( - !function_exists('random_bytes') + !is_callable('random_bytes') && $RandomCompatUrandom && @@ -125,7 +125,7 @@ if (PHP_VERSION_ID < 70000) { * mcrypt_create_iv() */ if ( - !function_exists('random_bytes') + !is_callable('random_bytes') && PHP_VERSION_ID >= 50307 && @@ -146,7 +146,7 @@ if (PHP_VERSION_ID < 70000) { $RandomCompatUrandom = null; if ( - !function_exists('random_bytes') + !is_callable('random_bytes') && extension_loaded('com_dotnet') && @@ -175,7 +175,7 @@ if (PHP_VERSION_ID < 70000) { /** * throw new Exception */ - if (!function_exists('random_bytes')) { + if (!is_callable('random_bytes')) { /** * We don't have any more options, so let's throw an exception right now * and hope the developer won't let it fail silently. @@ -189,7 +189,7 @@ if (PHP_VERSION_ID < 70000) { } } - if (!function_exists('random_int')) { + if (!is_callable('random_int')) { require_once $RandomCompatDIR.'/random_int.php'; } |