mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Change Security::randomBytes() to fallback to mcrypt_create_iv()
This commit is contained in:
parent
d7ed0339b1
commit
5289aae64e
1 changed files with 4 additions and 1 deletions
|
@ -191,9 +191,12 @@ class Security {
|
||||||
if (function_exists('openssl_random_pseudo_bytes')) {
|
if (function_exists('openssl_random_pseudo_bytes')) {
|
||||||
return openssl_random_pseudo_bytes($length);
|
return openssl_random_pseudo_bytes($length);
|
||||||
}
|
}
|
||||||
|
if (function_exists('mcrypt_create_iv')) {
|
||||||
|
return mcrypt_create_iv($length);
|
||||||
|
}
|
||||||
trigger_error(
|
trigger_error(
|
||||||
'You do not have a safe source of random data available. ' .
|
'You do not have a safe source of random data available. ' .
|
||||||
'Install either the openssl extension, or paragonie/random_compat. ' .
|
'Install either the openssl extension, the mcrypt extension, or paragonie/random_compat. ' .
|
||||||
'Falling back to an insecure random source.',
|
'Falling back to an insecure random source.',
|
||||||
E_USER_WARNING
|
E_USER_WARNING
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue