Skip to content

Commit 5f364af

Browse files
committed
bug #36121 [VarDumper] fix side-effect by not using mt_rand() (nicolas-grekas)
This PR was merged into the 3.4 branch. Discussion ---------- [VarDumper] fix side-effect by not using mt_rand() | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Reported by @bobthecow on Twitter: using `mt_rand()` breaks inspecting seeded calls to `mt_rand()`. Should be replaced by a call to `md5(random_bytes(6))` on 4.4. Commits ------- 8c85f91 [VarDumper] fix side-effect by not using mt_rand()
2 parents 2baa812 + 8c85f91 commit 5f364af

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Symfony/Component/VarDumper/Cloner/VarCloner.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ protected function doClone($var)
4848
// or null if the original value is used directly
4949

5050
if (!self::$hashMask) {
51-
self::$gid = uniqid(mt_rand(), true); // Unique string used to detect the special $GLOBALS variable
5251
self::initHashMask();
52+
self::$gid = md5(dechex(self::$hashMask)); // Unique string used to detect the special $GLOBALS variable
5353
}
5454
$gid = self::$gid;
5555
$hashMask = self::$hashMask;

0 commit comments

Comments
 (0)