Oh wow nice find. It seems like this should be reported as a bug.
They should probably wrap it in an if statement:
if (PHP4) { srand(); }
On Oct 1, 2:11 pm, Jamie <[email protected]> wrote:
> Well, it might be a bit of a band-aid, but I threw this just after
> line 61 of the AutoLoginComponent (in startup()):
>
> srand();
>
> And that seems to be fixing my seeding problems.
>
> - Jamie
>
> On Oct 1, 2:05 pm, Jamie <[email protected]> wrote:
>
> > Sorry for dragging up an old thread, but I'm having thissameproblem.
> > Using mt_rand() instead ofrand() wasn't appealing to me, since it
> > just 'fixes' a symptom instead of the underlying problem, so I decided
> > to hunt down the issue (using version 1.2.4).
>
> > I tracked the problem down to Security::cipher(), specifically line
> > 183, which is: srand(CIPHER_SEED);
>
> > srand() is seeding PHP's random number algorithm, and this seed seems
> > to stick through the entire load process of the application.
>
> > Here's the ironic part, since Miles is the one who started the thread
> > - the call to Security::cipher() is originally in your AutoLogin
> > component! :) Here's the 'stack':
>
> > - AutoLoginComponent::startup() line 61 calls CookieComponent::read()
> > - CookieComponent::read() line 238 calls CookieComponent::__decrypt()
> > - CookieComponent::__decrypt() line 427 calls Security::cipher()
> > - Security::cipher() line 183 calls srand()
>
> > And that's it... I think.
>
> > That said, I'm not sure how to go about fixing the issue. So maybe
> > I'll just use mt_rand() for now. ;)
>
> > - Jamie
>
> > On Aug 4, 6:03 pm, Miles J <[email protected]> wrote:
>
> > > Not necessarily, but ive been having this problem withrand() for
> > > months, but it got to the point where it caused problems.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---