My session bug, incredible, must read!
Moderator: General Moderators
- chrys
- Forum Contributor
- Posts: 118
- Joined: Tue Oct 04, 2005 9:41 am
- Location: West Roxbury, MA (Boston)
My session bug, incredible, must read!
As some of you may have noticed I have posted a few issues with sessions. I have finally found out what the problem is.
The current platform is as such:
Firefox
PHP
I have a PHP site that people use strictly with Firefox.
It took me forever to debug this, but here is the conclusion I came to:
When Firefox has stored more than 70 cookies for a domain, it starts to read selectively, and only reads 70 of them. The cookies that are selectively chosen are the ones after the 70 mark. I don't know if this is an issue related to Firefox storage, or to PHP readage. I am leaning towards Firefox, because Javascript also has the same issues reading the cookies past 70.
Has anyone heard anything bout this? Anyone have their input?
Thank you, but after months of suffering, I have finally figured this bug out. I am going to drink to that (that's how mystifyingly stressful it was)
The current platform is as such:
Firefox
PHP
I have a PHP site that people use strictly with Firefox.
It took me forever to debug this, but here is the conclusion I came to:
When Firefox has stored more than 70 cookies for a domain, it starts to read selectively, and only reads 70 of them. The cookies that are selectively chosen are the ones after the 70 mark. I don't know if this is an issue related to Firefox storage, or to PHP readage. I am leaning towards Firefox, because Javascript also has the same issues reading the cookies past 70.
Has anyone heard anything bout this? Anyone have their input?
Thank you, but after months of suffering, I have finally figured this bug out. I am going to drink to that (that's how mystifyingly stressful it was)
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
the HTTP standard dictated that clients who accept cookies only should store 4 per domain with a maximum of 4K of data in each. It's still up to the browser companies to choose how far they'll store, so Firefox allowing more than that is of their own choosing. I think you need to rethink how cookies are used on your site.
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
Sessions have, often, less in size limitations, however they often take up a cookie on their own. For file based sessions there's the server's clean-up routine that may bite you, so if you do use them, go with a database version. I try to pack all data used across the entire domain into a single session. I don't like how, at least right now, phpBB uses two to three cookies by itself. Hopefully I can fix that in the fork I'm working on.
- chrys
- Forum Contributor
- Posts: 118
- Joined: Tue Oct 04, 2005 9:41 am
- Location: West Roxbury, MA (Boston)
PHP Sessions just store one cookie with the session ID.
I will indeed have to rethink cookies in the future. For now my solutions is that the cookies I set expire after 10 minutes, since they're not needed for longer than that. The problem was those cookies would pile up. Eventually the PHPSESSID was getting pushed out of the range so people would be getting logged out and couldn't log back in, I finally figured out why!
I will indeed have to rethink cookies in the future. For now my solutions is that the cookies I set expire after 10 minutes, since they're not needed for longer than that. The problem was those cookies would pile up. Eventually the PHPSESSID was getting pushed out of the range so people would be getting logged out and couldn't log back in, I finally figured out why!