From 4abf4588ac6ab6e3542c52a1611dbc7a2e2950e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= <come@opensides.be> Date: Tue, 3 Jul 2018 10:32:19 +0200 Subject: [PATCH] :ambulance: fix(core) Avoid crash on 32-bits systems for random_int fallback We cannot use Q on 32-bits systems so we use L instead for a 32bits integer issue #5843 --- include/functions.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/functions.inc b/include/functions.inc index 8ec8ea645..f99669831 100644 --- a/include/functions.inc +++ b/include/functions.inc @@ -2483,7 +2483,7 @@ if (!function_exists('random_int')) { if (!$strong || ($randomBytes === FALSE)) { throw new Exception('Failed to get random bytes'); } - $rnd = unpack('Q', $randomBytes)[1]; + $rnd = unpack('L', $randomBytes)[1]; // discard irrelevant bits $rnd = $rnd & $filter; } while ($rnd >= $range); -- GitLab