Commit aaf38ca
committed
General: Use functions that are more random to reduce likelihood of UUID collisions.
`mt_rand` produces not fully random numbers which makes it so `wp_generate_uuid4` was more likely to produce a uuid which collides with another uuid it produced. This attempts to make those collisions much less likely.
Since `wp_rand` is a pluggable function, it's not loaded until after plugins have been loaded. In order to make it so this function can still be used early, it falls back first to `random_int`, which will throw an exception if it can't find an appropriate source of randomness, and then to the existing, but flawed, `mt_rand`.
Props johnbillion, peterwilsoncc, westonruter, mukesh27, siliconforks, alexodiy, juanmaguitar, audrasjb, joppuyo, jorbin.
Fixes #59239.
git-svn-id: https://develop.svn.wordpress.org/trunk@62054 602fd350-edb4-49c9-b593-d223f7449a821 parent d0dfc76 commit aaf38ca
1 file changed
+22
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7990 | 7990 | | |
7991 | 7991 | | |
7992 | 7992 | | |
| 7993 | + | |
7993 | 7994 | | |
7994 | 7995 | | |
7995 | 7996 | | |
7996 | 7997 | | |
| 7998 | + | |
| 7999 | + | |
| 8000 | + | |
| 8001 | + | |
| 8002 | + | |
| 8003 | + | |
| 8004 | + | |
| 8005 | + | |
| 8006 | + | |
| 8007 | + | |
| 8008 | + | |
| 8009 | + | |
| 8010 | + | |
7997 | 8011 | | |
7998 | 8012 | | |
7999 | | - | |
8000 | | - | |
8001 | | - | |
8002 | | - | |
8003 | | - | |
8004 | | - | |
8005 | | - | |
8006 | | - | |
| 8013 | + | |
| 8014 | + | |
| 8015 | + | |
| 8016 | + | |
| 8017 | + | |
| 8018 | + | |
| 8019 | + | |
| 8020 | + | |
8007 | 8021 | | |
8008 | 8022 | | |
8009 | 8023 | | |
| |||
0 commit comments