mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-10 07:34:34 +00:00
Update to Random_Compat 1.0.9.
This update includes fixes for Windows support & libSodium support, and removes the `Throwable` Polyfill due to PHP7 incompatibilities. Fixes #28633 git-svn-id: https://develop.svn.wordpress.org/trunk@35365 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -41,9 +41,11 @@
|
||||
*/
|
||||
function random_bytes($bytes)
|
||||
{
|
||||
if (!is_int($bytes)) {
|
||||
try {
|
||||
$bytes = RandomCompat_intval($bytes);
|
||||
} catch (TypeError $ex) {
|
||||
throw new TypeError(
|
||||
'Length must be an integer'
|
||||
'random_bytes(): $bytes must be an integer'
|
||||
);
|
||||
}
|
||||
if ($bytes < 1) {
|
||||
@@ -52,7 +54,7 @@ function random_bytes($bytes)
|
||||
);
|
||||
}
|
||||
|
||||
$buf = mcrypt_create_iv($bytes, MCRYPT_DEV_URANDOM);
|
||||
$buf = @mcrypt_create_iv($bytes, MCRYPT_DEV_URANDOM);
|
||||
if ($buf !== false) {
|
||||
if (RandomCompat_strlen($buf) === $bytes) {
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user