random_bytes() can throw an exception in some cases, since PHP 7.0.0rc3

pull/297/head
Aleksander Machniak 9 years ago
parent 77be69fa25
commit e85bbc9e9c

@ -1101,8 +1101,12 @@ class rcube_utils
{
// Use PHP7 true random generator
if (function_exists('random_bytes')) {
// random_bytes() can throw an exception in some cases
try {
$random = @random_bytes($length);
}
catch (Exception $e) {}
}
if (!$random) {
$random = openssl_random_pseudo_bytes($length);

Loading…
Cancel
Save