mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
FIX PHP 7.x should use random_bytes for entropy ahead of deprecated mcrypt lib
This commit is contained in:
parent
088d4ff222
commit
6f4162ed74
@ -24,6 +24,11 @@ class RandomGenerator
|
||||
{
|
||||
$isWin = preg_match('/WIN/', PHP_OS);
|
||||
|
||||
// PHP 7.1 preference, since mcrypt is deprecated
|
||||
if (function_exists('random_bytes')) {
|
||||
return bin2hex(random_bytes(64));
|
||||
}
|
||||
|
||||
// TODO Fails with "Could not gather sufficient random data" on IIS, temporarily disabled on windows
|
||||
if (!$isWin) {
|
||||
if (function_exists('mcrypt_create_iv')) {
|
||||
|
Loading…
Reference in New Issue
Block a user