diff --git a/libraries/config/ServerConfigChecks.php b/libraries/config/ServerConfigChecks.php index d97d702a18..5557a0f489 100644 --- a/libraries/config/ServerConfigChecks.php +++ b/libraries/config/ServerConfigChecks.php @@ -223,10 +223,12 @@ class ServerConfigChecks $random_func = 'openssl_random_pseudo_bytes'; } while (strlen($blowfishSecret) < 32) { - $byte = $random_func(1); + // Get random byte and strip highest bit + // to get ASCII only range + $byte = ord($random_func(1)) & 0x7f; // We want only ASCII chars - if (ord($byte) > 32 && ord($byte) < 127) { - $blowfishSecret .= $byte; + if ($byte > 32) { + $blowfishSecret .= chr($byte); } }