aboutsummaryrefslogtreecommitdiffstats
path: root/include/functions_session.inc.php
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2016-05-13 11:05:15 +0200
committerplegall <plg@piwigo.org>2016-05-13 11:05:15 +0200
commitbd0d2ae6459c63ed7f7060589297bf63ae1cc619 (patch)
tree66fa333d54fa39d7ea2e559cb607f0b594805934 /include/functions_session.inc.php
parent2543002c8bb751517947010814aa8128e2f368aa (diff)
parentbf81ba031575b8cd1ccc318f5d5a8f8ec7cb5049 (diff)
Merge branch '2.8'
Diffstat (limited to 'include/functions_session.inc.php')
-rw-r--r--include/functions_session.inc.php12
1 files changed, 11 insertions, 1 deletions
diff --git a/include/functions_session.inc.php b/include/functions_session.inc.php
index 0829bcfda..e75f22e12 100644
--- a/include/functions_session.inc.php
+++ b/include/functions_session.inc.php
@@ -64,11 +64,21 @@ function generate_key($size)
{
include_once(PHPWG_ROOT_PATH.'include/random_compat/random.php');
+ try
+ {
+ $bytes = random_bytes($size+10);
+ }
+ catch (Exception $ex)
+ {
+ include_once(PHPWG_ROOT_PATH.'include/srand.php');
+ $bytes = secure_random_bytes($size+10);
+ }
+
return substr(
str_replace(
array('+', '/'),
'',
- base64_encode(random_bytes($size+10))
+ base64_encode($bytes)
),
0,
$size