From: cmbecker69 at gmx dot de Operating system: WIN32 PHP version: 5.4.19 Package: Unknown/Other Function Bug Type: Feature/Change Request Bug description:uniqid(null, false) should guarantee unique identifier
Description: ------------ >From looking at the sources[1], it occurs to me that uniqid(null, false) doesn't *guarantee* to return a unique identifier on WIN32, because usleep(3) is skipped. As usleep() is implemented as PHP userland function since PHP 5.0.0[2], it seems to be reasonable and possible to add the equivalent to usleep(3) there. As far as I can tell, this won't introduce any BC issues, so the change might be done for PHP 5.4.x. Please note that this is related to #37106[3], but helly's comment doesn't seem to fit to the current sources. [1] <http://lxr.php.net/xref/PHP_5_4/ext/standard/uniqid.c#61> [2] <http://lxr.php.net/xref/PHP_5_4/win32/time.c#96> [3] <https://bugs.php.net/bug.php?id=37106> Test script: --------------- var_dump(uniqid(null, false) != uniqid(null, false)); Expected result: ---------------- bool(true) Actual result: -------------- bool(false) // at least sometimes on a fast machine ;) -- Edit bug report at https://bugs.php.net/bug.php?id=65626&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=65626&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=65626&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=65626&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=65626&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=65626&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=65626&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=65626&r=needscript Try newer version: https://bugs.php.net/fix.php?id=65626&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=65626&r=support Expected behavior: https://bugs.php.net/fix.php?id=65626&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=65626&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=65626&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=65626&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=65626&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=65626&r=dst IIS Stability: https://bugs.php.net/fix.php?id=65626&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=65626&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=65626&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=65626&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=65626&r=mysqlcfg