safari/opera session cookie deleted prematurely
I've set a PHP session cookie with lifetime 0 (to expire on browser close) but I've been getting logged out of the session after only a few seconds.
I am observing the safari cookies popup window (in safari preferences) and while reloading the page I see the cookie vanish from the list only to be replaced by a new session id when being redirected to the login page (where a new session is started and thus cookie set).
This behaves the same way with opera.
Firefox is fine however. In fact I've been using the site for a while without any trouble in firefox so if it were to affect it too I would have seen it by now.I have tried tooling with numerous HTTP headers like Cache-control, checked that session_write_close()
is in the right spots (but really this shouldn't matter because I'm just refreshing the page), also I checked the session garbage clean up settings, but when I saw these cookies vanish on their own I almost jumped out of my socks!
mac 10.6.4 opera 10.10 safari 5.0.2
I should also mention this site has ajax requests going on, though none of them attempt to destroy the session or remove the cookie in any way (directly).
EDIT: Just tested on win XP: FF okay, Safari same phenonmenon as on Mac.
EDIT: This short video illustrates this is开发者_如何学Pythonsue on Windows.
Take a look at this thread:
https://discussions.apple.com/thread/4032092
My best answer is, instead of setting no expiration, set an explicit date/time in the future.
精彩评论