Replace `mt_rand()` with `random_int()` in non-deprecated methods
authorTim Düsterhus <duesterhus@woltlab.com>
Mon, 1 Aug 2022 09:35:15 +0000 (11:35 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Mon, 1 Aug 2022 09:35:15 +0000 (11:35 +0200)
wcfsetup/install/files/lib/system/io/AtomicWriter.class.php
wcfsetup/install/files/lib/system/registry/RegistryHandler.class.php
wcfsetup/install/files/lib/system/user/storage/UserStorageHandler.class.php
wcfsetup/install/files/lib/util/UserRegistrationUtil.class.php

index 858ba0cc8853fce221d692f4d16222bffb784f56..0122dd46235f1465f548587da6c7083a7ae6566d 100644 (file)
@@ -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
             }
         }
     }
index e6f19216945cb379ae9c31bbc83088833ee8a124..dd7348f6971b1787ca296fe298f626622e8d9543 100644 (file)
@@ -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 = [];
index 93a8721b266712726241205a802ed94e0a249ccd..d101cdd24c2f4870d7d32153442c2c6459994567 100644 (file)
@@ -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
             }
         }
     }
index 684689c64ba73dc5770a81c29e75f00331dcf8ab..2ee0af6b0e0b51eed2e19b406fddcf63ac245978 100644 (file)
@@ -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));
     }
 }