On Tue, Nov 26, 2013 at 5:19 PM, Ferenc Kovacs <tyra3l@gmail.com> wrote:
> 2013.11.26. 7:31, "Nikita Popov" <nikita.ppv@gmail.com> ezt írta:
> >
> > On Mon, Nov 25, 2013 at 8:30 PM, Eric Stenson <ericsten@microsoft.com
> >wrote:
> >
> > > diff --git a/ext/standard/tests/strings/implode1.phpt
> > > b/ext/standard/tests/strings/implode1.phpt
> > > index
> > >
>
> 3997c54b59eb3b86777b64b58f7ce67f25acac55..3720c069276784a1b588da672f9731c89b4e5fb7
> > > 100644
> > > GIT binary patch
> > > delta 32
> > > ncmeyY&D<tbfFK6f3Ks)Z+ZoqU2PC%oGJ>)s)RAM6{Uz()tUF
> > >
> > > delta 30
> > > lcmeyW&oCxbe2SE32T?;{4L0<Wz;s6a{6o&8I}PnE<>^3giF)
> > >
> >
> > What's being changed here?
> >
> > diff --git a/tests/strings/001.phpt b/tests/strings/001.phpt
> > > index 3bfd3db..7b61835 100644
> > > --- a/tests/strings/001.phpt
> > > +++ b/tests/strings/001.phpt
> > > @@ -180,6 +180,8 @@ if ($ss == "\$'") {
> > > echo "Testing uniqid: ";
> > > $str = "prefix";
> > > $ui1 = uniqid($str);
> > > +/* Must sleep here to let uniqid generate a different unique ID */
> > > +usleep( 10 );
> > > $ui2 = uniqid($str);
> > >
> > > $len = strncasecmp(PHP_OS, 'CYGWIN', 6) ? 19 : 29;
> > >
> >
> > Not sure this is right. uniqid() should generate different IDs even when
> > there are two subsequent calls. If it doesn't, that sounds like a bug.
> >
> > Nikita
>
> Only if the time is different, and AFAIR some platforms(like win) has less
> microtime precision, which could cause problems like that.
> But there is a more entropy param for uniqid, maybe that would be a better
> solution than sleep.
>
Internally, uniqid() uses usleep(1) only if 'more entropy' is omitted and
not on Windows and Cygwin (must use 'more entropy').
So, when 'more entropy' is present, it will skip usleep(1) but pad the
result with php_combined_lcg().
I'm sure there was a good reason to do so, but it does seem
counter-intuitive at best.
--
--
Tjerk