Skip to content

Commit 493bc1d

Browse files
committed
fix: sonarcloud security issue
Make sure that using this pseudorandom number generator is safe here.
1 parent bc18af0 commit 493bc1d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Html/HtmlBuilder.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,7 @@ public function email(string $email): string
364364
*
365365
* @param string $value
366366
* @return string
367+
* @throws \Exception
367368
*/
368369
public function obfuscate(string $value): string
369370
{
@@ -377,7 +378,7 @@ public function obfuscate(string $value): string
377378
// To properly obfuscate the value, we will randomly convert each letter to
378379
// its entity or hexadecimal representation, keeping a bot from sniffing
379380
// the randomly obfuscated letters out of the string on the responses.
380-
switch (rand(1, 3)) {
381+
switch (random_int(1, 3)) {
381382
case 1:
382383
$safe .= '&#'.ord($letter).';';
383384
break;

0 commit comments

Comments
 (0)