8000 Merge pull request #9032 from laravel/5.0-rand-fix · laravel/framework@a321dc9 · GitHub
[go: up one dir, main page]

Skip to content

Commit a321dc9

Browse files
author
Graham Campbell
committed
Merge pull request #9032 from laravel/5.0-rand-fix
[5.0] Make sure our random string is random
2 parents 42b3f4c + 48f52e4 commit a321dc9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Illuminate/Support/Str.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,9 @@ public static function random($length = 16)
218218
throw new RuntimeException('OpenSSL extension is required.');
219219
}
220220

221-
$bytes = openssl_random_pseudo_bytes($length * 2);
221+
$bytes = openssl_random_pseudo_bytes($length * 2, $strong);
222222

223-
if ($bytes === false)
223+
if ($bytes === false || $strong === false)
224224
{
225225
throw new RuntimeException('Unable to generate random string.');
226226
}

0 commit comments

Comments
 (0)
0