mirror of
https://github.com/phpseclib/phpseclib.git
synced 2025-01-27 00:58:25 +00:00
Random: return empty string if $length is 0
This commit is contained in:
parent
703f7840db
commit
ab5158dcd3
@ -67,6 +67,10 @@ if (!function_exists('crypt_random_string')) {
|
|||||||
*/
|
*/
|
||||||
function crypt_random_string($length)
|
function crypt_random_string($length)
|
||||||
{
|
{
|
||||||
|
if (!$length) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
if (CRYPT_RANDOM_IS_WINDOWS) {
|
if (CRYPT_RANDOM_IS_WINDOWS) {
|
||||||
// method 1. prior to PHP 5.3, mcrypt_create_iv() would call rand() on windows
|
// method 1. prior to PHP 5.3, mcrypt_create_iv() would call rand() on windows
|
||||||
if (extension_loaded('mcrypt') && version_compare(PHP_VERSION, '5.3.0', '>=')) {
|
if (extension_loaded('mcrypt') && version_compare(PHP_VERSION, '5.3.0', '>=')) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user