Replace use MathUtil::getRandomValue() by random_int()
authorTim Düsterhus <duesterhus@woltlab.com>
Fri, 6 Nov 2020 08:57:13 +0000 (09:57 +0100)
committerTim Düsterhus <duesterhus@woltlab.com>
Fri, 6 Nov 2020 08:57:13 +0000 (09:57 +0100)
wcfsetup/install/files/lib/system/user/notification/TestableUserNotificationEventHandler.class.php
wcfsetup/install/files/lib/util/UserRegistrationUtil.class.php

index 633fe5d1ea48151490f58526659223eb5f07defd..d5a3822488dd1b7eb8fdfbcc28437c1773755ffc 100644 (file)
@@ -16,7 +16,6 @@ use wcf\system\language\LanguageFactory;
 use wcf\system\user\notification\event\ITestableUserNotificationEvent;
 use wcf\system\SingletonFactory;
 use wcf\system\WCF;
-use wcf\util\MathUtil;
 use wcf\util\PasswordUtil;
 use wcf\util\StringUtil;
 
@@ -78,7 +77,7 @@ class TestableUserNotificationEventHandler extends SingletonFactory {
                                                'email' => $username . '@example.com',
                                                'languageID' => $languages[array_rand($languages)]->languageID,
                                                'password' => PasswordUtil::getRandomPassword(),
-                                               'registrationDate' => TIME_NOW - 24 * 3600 * MathUtil::getRandomValue(10, 1000),
+                                               'registrationDate' => TIME_NOW - 24 * 3600 * random_int(10, 1000),
                                                'username' => $username
                                        ]
                                ]))->executeAction()['returnValues'];
index f0ab7f805286cd93d16f1fa7b60f84738fd3654f..04891221435169e47436bd7d5d726a7ea0b9dde3 100644 (file)
@@ -95,7 +95,7 @@ final class UserRegistrationUtil {
         * @return      integer
         */
        public static function getActivationCode($length = 9) {
-               return MathUtil::getRandomValue(pow(10, $length - 1), pow(10, $length) - 1);
+               return random_int(pow(10, $length - 1), pow(10, $length) - 1);
        }
        
        /**