This is a discussion on Session Errors within the PHP Language forums, part of the PHP Programming Forums category; Friends, Now I have another problem. I have unset all session variables (TWICE). And still sometimes, when I refresh pages, ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi Avinash!
On 5 Oct 2003 19:02:25 -0700, avinashkorwarkar@yahoo.com (Avinash Korwarkar) wrote: >Friends, > >Now I have another problem. I have unset all session variables >(TWICE). And still sometimes, when I refresh pages, I get information >for the user who logged in before me. > Did yoy maybe do it in a function? I found it very surprising as well, but unset does unset superglobals in a function only in the local context. That means they are unchanged outside. That behaviour is somehow hidden on www.php.net in the descriptions of unset and the superglobals. Use $_SESSION["x"] = array() instead. HTH, Jochen -- Jochen Daum - CANS Ltd. PHP DB Edit Toolkit -- PHP scripts for building database editing interfaces. http://sourceforge.net/projects/phpdbedittk/ |
|
|||
|
Jochen Daum <jochen.daum@cans.co.nz> wrote in
news:p4j1ov0ohl4ruf0e0drmi41pjo36ghq4s4@4ax.com: > Did yoy maybe do it in a function? > > I found it very surprising as well, but unset does unset superglobals > in a function only in the local context. That means they are unchanged > outside. That behaviour is somehow hidden on www.php.net in the > descriptions of unset and the superglobals. > > Use $_SESSION["x"] = array() instead. The safest way in my experience is to use session_destroy()/unset(). KAH |