diff options
-rw-r--r-- | README.md | 6 | ||||
-rw-r--r-- | lib/random.php | 9 |
2 files changed, 9 insertions, 6 deletions
@@ -22,9 +22,9 @@ For the background of this library, please refer to our blog post on ### Usability Notice -If PHP cannot safely generate random data, this library will throw an `Exception` -when you include it, even if it's never used. It will not fall back to insecure -random data. +If PHP cannot safely generate random data, this library will throw an `Exception`. +It will never fall back to insecure random data. If this keeps happening, upgrade +to a newer version of PHP immediately. ## Features diff --git a/lib/random.php b/lib/random.php index df87439..398c129 100644 --- a/lib/random.php +++ b/lib/random.php @@ -68,9 +68,12 @@ if (PHP_VERSION_ID < 70000) { * We don't have any more options, so let's throw an exception right now * and hope the developer won't let it fail silently. */ - throw new Exception( - 'There is no suitable CSPRNG installed on your system' - ); + function random_bytes() + { + throw new Exception( + 'There is no suitable CSPRNG installed on your system' + ); + } } } if (!function_exists('random_int')) { |