mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-11 08:04:32 +00:00
Update Random_Compat from 1.1.6 to 1.2.1.
Changes: https://github.com/paragonie/random_compat/compare/1.1.6...v1.2.1 See #35665. git-svn-id: https://develop.svn.wordpress.org/trunk@36886 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -48,6 +48,7 @@ function random_bytes($bytes)
|
||||
'random_bytes(): $bytes must be an integer'
|
||||
);
|
||||
}
|
||||
|
||||
if ($bytes < 1) {
|
||||
throw new Error(
|
||||
'Length must be greater than 0'
|
||||
@@ -55,14 +56,17 @@ function random_bytes($bytes)
|
||||
}
|
||||
|
||||
$buf = @mcrypt_create_iv($bytes, MCRYPT_DEV_URANDOM);
|
||||
if ($buf !== false) {
|
||||
if (RandomCompat_strlen($buf) === $bytes) {
|
||||
/**
|
||||
* Return our random entropy buffer here:
|
||||
*/
|
||||
return $buf;
|
||||
}
|
||||
if (
|
||||
$buf !== false
|
||||
&&
|
||||
RandomCompat_strlen($buf) === $bytes
|
||||
) {
|
||||
/**
|
||||
* Return our random entropy buffer here:
|
||||
*/
|
||||
return $buf;
|
||||
}
|
||||
|
||||
/**
|
||||
* If we reach here, PHP has failed us.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user