From 228b60cfe530c901ad1c7a084286ba9e3f1a34da Mon Sep 17 00:00:00 2001 From: terrafrost Date: Sun, 28 May 2017 09:53:02 -0500 Subject: [PATCH] Random: suppress E_DEPRECATED errors --- phpseclib/Crypt/Random.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpseclib/Crypt/Random.php b/phpseclib/Crypt/Random.php index 472d47c0..18034216 100644 --- a/phpseclib/Crypt/Random.php +++ b/phpseclib/Crypt/Random.php @@ -70,7 +70,7 @@ if (!function_exists('crypt_random_string')) { if (CRYPT_RANDOM_IS_WINDOWS) { // method 1. prior to PHP 5.3, mcrypt_create_iv() would call rand() on windows if (extension_loaded('mcrypt') && version_compare(PHP_VERSION, '5.3.0', '>=')) { - return mcrypt_create_iv($length); + return @mcrypt_create_iv($length); } // method 2. openssl_random_pseudo_bytes was introduced in PHP 5.3.0 but prior to PHP 5.3.4 there was, // to quote , "possible blocking behavior". as of 5.3.4 @@ -109,7 +109,7 @@ if (!function_exists('crypt_random_string')) { // not doing. regardless, this'll only be called if this PHP script couldn't open /dev/urandom due to open_basedir // restrictions or some such if (extension_loaded('mcrypt')) { - return mcrypt_create_iv($length, MCRYPT_DEV_URANDOM); + return @mcrypt_create_iv($length, MCRYPT_DEV_URANDOM); } } // at this point we have no choice but to use a pure-PHP CSPRNG