|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-10-18 15:29 UTC] nohn@php.net
Description:
------------
Taking the regression test tests/strings/001.phpt, uniqid behaves different on Cygwin than specified in the manual.
This may be related to #2201, but the very same test acts on Linux as expected.
Reproduce code:
---------------
<?php
echo "Testing uniqid: ";
$str = "prefix";
$ui1 = uniqid($str);
$ui2 = uniqid($str);
if (strlen($ui1) == strlen($ui2) && strlen($ui1) == 19 && $ui1 != $ui2) {
echo("passed\n");
} else {
echo("failed!\n");
}
var_dump(strlen($ui1));
var_dump(strlen($ui2));
var_dump($ui1);
var_dump($ui2);
?>
Expected result:
----------------
$ php ~/test.php
Testing uniqid: failed!
int(29)
int(29)
string(29) "prefix4354f7719641d8"
string(29) "prefix4354f7719641d3"
Actual result:
--------------
$ php ~/test.php
Testing uniqid: failed!
int(29)
int(29)
string(29) "prefix4354f7719641d8.40924743"
string(29) "prefix4354f7719641d3.17144927"
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 14:00:01 2025 UTC |
184c185,192 < if (strlen($ui1) == strlen($ui2) && strlen($ui1) == 19 && $ui1 != $ui2) { --- > > if (strtoupper(substr(php_uname(), 0, 6)) === 'CYGWIN') { > $expected_length = 29; > } else { > $expected_length = 19; > } > > if (strlen($ui1) == strlen($ui2) && strlen($ui1) == $expected_length && $ui1 != $ui2) {