Fix rcube_utils::random_bytes() to not throw exception for length=0

pull/6002/head
Thomas Bruederli 7 years ago
parent c56c9c5e40
commit 3723f3f178

@ -1160,7 +1160,7 @@ class rcube_utils
$random = openssl_random_pseudo_bytes($length); $random = openssl_random_pseudo_bytes($length);
if ($random === false) { if ($random === false && $length > 0) {
throw new Exception("Failed to get random bytes"); throw new Exception("Failed to get random bytes");
} }

Loading…
Cancel
Save