[wp-trac] [WordPress Trac] #59239: wp_generate_uuid4 collisions
WordPress Trac
noreply at wordpress.org
Thu Mar 19 03:49:35 UTC 2026
#59239: wp_generate_uuid4 collisions
--------------------------------------------+---------------------
Reporter: joppuyo | Owner: jorbin
Type: defect (bug) | Status: closed
Priority: normal | Milestone: 7.0
Component: General | Version:
Severity: normal | Resolution: fixed
Keywords: has-patch needs-testing commit | Focuses:
--------------------------------------------+---------------------
Changes (by jorbin):
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"62054" 62054]:
{{{
#!CommitTicketReference repository="" revision="62054"
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.
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/59239#comment:19>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list