Fix handling random_bytes() errors in PHP 7.0.0RC3

pull/260/merge
Aleksander Machniak 9 years ago
parent 2368ab91c2
commit b2b9b591ce

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

Loading…
Cancel
Save