Replace function rand with mt_rand (prepare php 8)

This commit is contained in:
Laurent Destailleur
2016-03-05 15:01:25 +01:00
parent d8045e33bb
commit d1777a6783
15 changed files with 36 additions and 36 deletions

View File

@@ -5393,7 +5393,7 @@ function dol_set_focus($selector)
function dol_getmypid()
{
if (! function_exists('getmypid')) {
return rand(1,32768);
return mt_rand(1,32768);
} else {
return getmypid();
}

View File

@@ -134,19 +134,19 @@ class modGeneratePassPerso extends ModeleGenPassword
{
$pass = "";
for($i=0; $i<$this->NbMaj; $i++){ // Y
$pass .= $this->Maj[rand(0,strlen($this->Maj) - 1)];
$pass .= $this->Maj[mt_rand(0,strlen($this->Maj) - 1)];
}
for($i=0; $i<$this->NbNum; $i++){ // X
$pass .= $this->Nb[rand(0,strlen($this->Nb) - 1)];
$pass .= $this->Nb[mt_rand(0,strlen($this->Nb) - 1)];
}
for($i=0; $i<$this->NbSpe; $i++){ // @
$pass .= $this->Spe[rand(0,strlen($this->Spe) - 1)];
$pass .= $this->Spe[mt_rand(0,strlen($this->Spe) - 1)];
}
for($i=strlen($pass);$i<$this->length2; $i++){ // y
$pass .= $this->All[rand(0,strlen($this->All) -1)];
$pass .= $this->All[mt_rand(0,strlen($this->All) -1)];
}
$pass = str_shuffle($pass);