Skip to content

Commit 851bd69

Browse files
committed
random_int is more Crypto secure
1 parent e4e4c05 commit 851bd69

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

nodeapp.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,9 @@ public function generate_nginx_files( $nodeapp_folder, $inc_root = true ) {
313313
*/
314314
public function random_chars( $length = 10, $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890' ) {
315315
$string = '';
316+
$max_index = strlen( $chars ) - 1;
316317
for ( $i = 0; $i < $length; $i++ ) {
317-
$string .= $chars[rand( 0, strlen( $chars ) - 1 )];
318+
$string .= $chars[random_int( 0, $max_index )]; // random_int is more crypto secure
318319
}
319320
return $string;
320321
}

0 commit comments

Comments
 (0)