Question : php session variable lifecycle

Hi, I just wanted confirmation of a behaviour i've observer with how php assigns session id specifically with firefox 3.6 haven't looked at other browsers.
webserver is apache..

It seems that a new session id is only assigned when ALL instances of firefox have been closed.

For example

I open site A in one browser and it is assigned session id foo123
i open site B in another browser instance (or tab)
I close the browser for site A. At this point, i assumed that the session for site A would be destroyed.
However, when I open site A in a new browser, i get the same session  id (ie foo123)
Only when I close browser for site B as well do I get an new session id at site A.
This seems weird to me...am i missing something here ?
Thanks

Answer : php session variable lifecycle

No, you are not missing something... This is the intended behavior of the browser.

When the session is created, it exists within the running instance of the browser (firefox.exe). While one window remains open, that assigned session will remain. This behavior is not specific to firefox either.

Upon the first request, the server will generate a unique session from that requesting host. Every subsequent request from the browser is associated with that session. Not until the browser is closed will the session be terminated and a new session ID generated. In some cases, the session will remain active for a period even after the browser is closed. This is governed by the php application requesting and processing the data. (think cookies storing usernames for return visits)
Random Solutions  
 
programming4us programming4us