Use random_compat

This commit is contained in:
Paragon Initiative Enterprises 2016-03-24 16:44:56 -04:00 committed by Scott
parent 2ae82a1bc7
commit 1ca62c2c33
2 changed files with 2 additions and 1 deletions

View File

@ -51,6 +51,7 @@
}
],
"require": {
"paragonie/random_compat": "^1.4",
"php": ">=5.3.3"
},
"require-dev": {

View File

@ -46,7 +46,7 @@ class Random
*/
static function string($length)
{
if (version_compare(PHP_VERSION, '7.0.0', '>=')) {
if (version_compare(PHP_VERSION, '7.0.0', '>=') || defined('RANDOM_COMPAT_READ_BUFFER')) {
try {
return \random_bytes($length);
} catch (\Throwable $e) {