Skip to content

Commit

Permalink
random_bytes() only for >PHP7 (#1066)
Browse files Browse the repository at this point in the history
  • Loading branch information
paponius committed Jun 29, 2023
1 parent f380478 commit eb8f3d8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tinyfilemanager.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,11 @@ function session_error_handling_function($code, $msg, $file, $line) {

//Generating CSRF Token
if (empty($_SESSION['token'])) {
$_SESSION['token'] = bin2hex(random_bytes(32));
if (function_exists('random_bytes')) {
$_SESSION['token'] = bin2hex(random_bytes(32));
} else {
$_SESSION['token'] = bin2hex(openssl_random_pseudo_bytes(32));

This comment has been minimized.

Copy link
@ner00

ner00 Jun 29, 2023

Contributor

irregular indentation; 4 spaces and 1 tab instead of 8 spaces.

This comment has been minimized.

Copy link
@prasathmani

prasathmani Jun 30, 2023

Owner

@paponius please check

This comment has been minimized.

Copy link
@paponius

paponius Aug 1, 2023

Author Contributor

thanks, I missed that one.
#1076

}
}

if (empty($auth_users)) {
Expand Down

0 comments on commit eb8f3d8

Please sign in to comment.