Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replaced rand() with mt_rand() projectwide #12169

Merged
merged 4 commits into from
Oct 18, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion libraries/cms/html/email.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion libraries/joomla/user/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion plugins/twofactorauth/yubikey/yubikey.php
Original file line number Diff line number Diff line change
Expand Up @@ -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))
{
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/suites/libraries/cms/html/JHtmlBehaviorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
8 changes: 4 additions & 4 deletions tests/unit/suites/libraries/cms/html/JHtmlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down