Skip to content

Commit

Permalink
Fix handling random_bytes() errors in PHP 7.0.0RC3
Browse files Browse the repository at this point in the history
  • Loading branch information
alecpl committed Sep 18, 2015
1 parent 2368ab9 commit b2b9b59
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions program/lib/Roundcube/rcube_utils.php
Expand Up @@ -1101,11 +1101,11 @@ public static function random_bytes($length, $raw = false)
{
// 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) {
Expand Down

0 comments on commit b2b9b59

Please sign in to comment.