diff --git a/libraries/cms/html/email.php b/libraries/cms/html/email.php index f31f5c524573f..12bfa1be8fc69 100644 --- a/libraries/cms/html/email.php +++ b/libraries/cms/html/email.php @@ -48,7 +48,7 @@ public static function cloak($mail, $mailto = true, $text = '', $email = true) $mail = static::convertEncoding($mail); // Random hash - $rand = md5($mail . rand(1, 100000)); + $rand = md5($mail . mt_rand(1, 100000)); // Split email by @ symbol $mail = explode('@', $mail); diff --git a/libraries/joomla/user/helper.php b/libraries/joomla/user/helper.php index c03e924c8d101..4362849b2c147 100644 --- a/libraries/joomla/user/helper.php +++ b/libraries/joomla/user/helper.php @@ -612,7 +612,7 @@ public static function getSalt($encryption = 'md5-hex', $seed = '', $plaintext = for ($i = 0; $i < 8; $i++) { - $salt .= $APRMD5{rand(0, 63)}; + $salt .= $APRMD5{mt_rand(0, 63)}; } return $salt; diff --git a/plugins/twofactorauth/yubikey/yubikey.php b/plugins/twofactorauth/yubikey/yubikey.php index 3f23b016d8d3e..c991b31e61b05 100644 --- a/plugins/twofactorauth/yubikey/yubikey.php +++ b/plugins/twofactorauth/yubikey/yubikey.php @@ -275,7 +275,7 @@ public function validateYubikeyOtp($otp) $http = JHttpFactory::getHttp(); $token = JSession::getFormToken(); - $nonce = md5($token . uniqid(rand())); + $nonce = md5($token . uniqid(mt_rand())); while (!$gotResponse && !empty($server_queue)) { diff --git a/tests/unit/suites/libraries/cms/html/JHtmlBehaviorTest.php b/tests/unit/suites/libraries/cms/html/JHtmlBehaviorTest.php index 472cae43f5644..6dd59b93ca7be 100644 --- a/tests/unit/suites/libraries/cms/html/JHtmlBehaviorTest.php +++ b/tests/unit/suites/libraries/cms/html/JHtmlBehaviorTest.php @@ -50,7 +50,7 @@ protected function setUp() // We generate a random template name so that we don't collide or hit anything JFactory::$application->expects($this->any()) ->method('getTemplate') - ->willReturn('mytemplate' . rand(1, 10000)); + ->willReturn('mytemplate' . mt_rand(1, 10000)); $this->backupServer = $_SERVER; diff --git a/tests/unit/suites/libraries/cms/html/JHtmlTest.php b/tests/unit/suites/libraries/cms/html/JHtmlTest.php index 498e89bf5037d..36706282fae55 100644 --- a/tests/unit/suites/libraries/cms/html/JHtmlTest.php +++ b/tests/unit/suites/libraries/cms/html/JHtmlTest.php @@ -310,7 +310,7 @@ public function testImage() $urlfilename = 'image1.jpg'; // We generate a random template name so that we don't collide or hit anything. - $template = 'mytemplate' . rand(1, 10000); + $template = 'mytemplate' . mt_rand(1, 10000); // We create a stub (not a mock because we don't enforce whether it is called or not) // to return a value from getTemplate. @@ -575,7 +575,7 @@ public function testScript() $urlfilename = 'script1.js'; // We generate a random template name so that we don't collide or hit anything. - $template = 'mytemplate' . rand(1, 10000); + $template = 'mytemplate' . mt_rand(1, 10000); // We create a stub (not a mock because we don't enforce whether it is called or not) // to return a value from getTemplate. @@ -924,7 +924,7 @@ public function testStylesheet() $urlfilename = 'style1.css'; // We generate a random template name so that we don't collide or hit anything. - $template = 'mytemplate' . rand(1, 10000); + $template = 'mytemplate' . mt_rand(1, 10000); // We create a stub (not a mock because we don't enforce whether it is called or not) // to return a value from getTemplate. @@ -1290,7 +1290,7 @@ public function testStylesheet() public function testTooltip() { // We generate a random template name so that we don't collide or hit anything - $template = 'mytemplate' . rand(1, 10000); + $template = 'mytemplate' . mt_rand(1, 10000); // We create a stub (not a mock because we don't enforce whether it is called or not) // to return a value from getTemplate