#59701uniqid() not returning unique values
Description
uniqid() generates values based on current time,
subsequent calls may return the same value on a fast machine.
On Windows it’s even worse, as uniqid()
has single-second-resolution out of the box.
Right now it is used in many places in the core, also for creating temporary identifiers for newly created records (in the datahanlder)
The solution is to add a second parameter to all calls (which adds more entropy).
see http://php.net/manual/en/function.uniqid.php
uniqid(“prefix”) => uniqid(“prefix”, TRUE)
With an empty prefix, the returned string will be 13 characters long. If more_entropy is TRUE, it will be 23 characters. So we need to test whether having longer id doesn;t break anything.
Reviews 2
Related issues 8
- Bug #58602Datepicker issue on multiple datetime fields in BE
- Bug #58768Import from .t3d failed on Windows 7 with a lot of messages (6.1 => 6.2)
- Bug #59055Import from .t3d failed on Windows 7 with a lot of messages
- Bug #59529Make Functional tests work on fast machines (especially on Windows)
- Bug #62438Fix JS error after #30948
- Bug #63943PHPUnit-Tests fail on Windows
- Task #69050Supply a Utility method to create unique ids in the core
- Bug #91553Risk of non-unique field in DatePickerViewHelper