Session Errors

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, ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 10-06-2003
Avinash Korwarkar
 
Posts: n/a
Default Session Errors

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.

Please advice. Thanks.
Reply With Quote
  #2 (permalink)  
Old 10-06-2003
Jochen Daum
 
Posts: n/a
Default Re: Session Errors

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/
Reply With Quote
  #3 (permalink)  
Old 10-07-2003
KAH
 
Posts: n/a
Default Re: Session Errors

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
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 06:27 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0