From a09bd174a122173245647ddfcc640f58d2efc2cc Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Mon, 1 Aug 2022 11:35:15 +0200 Subject: [PATCH] Replace `mt_rand()` with `random_int()` in non-deprecated methods --- wcfsetup/install/files/lib/system/io/AtomicWriter.class.php | 2 +- .../install/files/lib/system/registry/RegistryHandler.class.php | 2 +- .../files/lib/system/user/storage/UserStorageHandler.class.php | 2 +- wcfsetup/install/files/lib/util/UserRegistrationUtil.class.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/wcfsetup/install/files/lib/system/io/AtomicWriter.class.php b/wcfsetup/install/files/lib/system/io/AtomicWriter.class.php index 858ba0cc88..0122dd4623 100644 --- a/wcfsetup/install/files/lib/system/io/AtomicWriter.class.php +++ b/wcfsetup/install/files/lib/system/io/AtomicWriter.class.php @@ -110,7 +110,7 @@ class AtomicWriter extends File throw $e; } - \usleep(\mt_rand(0, .1e6)); // 0 to .1 seconds + \usleep(\random_int(0, .1e6)); // 0 to .1 seconds } } } diff --git a/wcfsetup/install/files/lib/system/registry/RegistryHandler.class.php b/wcfsetup/install/files/lib/system/registry/RegistryHandler.class.php index e6f1921694..dd7348f697 100644 --- a/wcfsetup/install/files/lib/system/registry/RegistryHandler.class.php +++ b/wcfsetup/install/files/lib/system/registry/RegistryHandler.class.php @@ -224,7 +224,7 @@ class RegistryHandler extends SingletonFactory break; } - \usleep(\mt_rand(0, .1e6)); // 0 to .1 seconds + \usleep(\random_int(0, .1e6)); // 0 to .1 seconds } } $this->resetFields = $this->updateFields = []; diff --git a/wcfsetup/install/files/lib/system/user/storage/UserStorageHandler.class.php b/wcfsetup/install/files/lib/system/user/storage/UserStorageHandler.class.php index 93a8721b26..d101cdd24c 100644 --- a/wcfsetup/install/files/lib/system/user/storage/UserStorageHandler.class.php +++ b/wcfsetup/install/files/lib/system/user/storage/UserStorageHandler.class.php @@ -335,7 +335,7 @@ class UserStorageHandler extends SingletonFactory break; } - \usleep(\mt_rand(0, .1e6)); // 0 to .1 seconds + \usleep(\random_int(0, .1e6)); // 0 to .1 seconds } } } diff --git a/wcfsetup/install/files/lib/util/UserRegistrationUtil.class.php b/wcfsetup/install/files/lib/util/UserRegistrationUtil.class.php index 684689c64b..2ee0af6b0e 100644 --- a/wcfsetup/install/files/lib/util/UserRegistrationUtil.class.php +++ b/wcfsetup/install/files/lib/util/UserRegistrationUtil.class.php @@ -132,6 +132,6 @@ final class UserRegistrationUtil { $hash = StringUtil::getRandomID(); - return \substr($hash, 0, \mt_rand(8, 16)); + return \substr($hash, 0, \random_int(8, 16)); } } -- 2.20.1