I noticed some erratic behavior with CakePHP sessions and finally tracked down the error. I have FireBug installed with an extension called FirePHP. When FireBug is enabled, I noticed that my User-Agent tends to vary.
Sometimes my browser’s user agent reads :
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:188.8.131.52) Gecko/20100202 Firefox/3.5.8 FirePHP/0.4
Sometimes it reads :
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:184.108.40.206) Gecko/20100202 Firefox/3.5.8
Whenever the User-Agent changes, CakePHP resets the session. This means that I can’t view 3-4 pages on the site before being logged out.
This is the firebug extension that caused the problem.
Here’s a link to an error report on FirePHP’s forums
This is a great add-on called HTTPFox I used to track down this error.