Session Errors

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Avinash Korwarkar

    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.
  • Jochen Daum

    #2
    Re: Session Errors

    Hi Avinash!

    On 5 Oct 2003 19:02:25 -0700, avinashkorwarka r@yahoo.com (Avinash
    Korwarkar) wrote:
    [color=blue]
    >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.
    >[/color]
    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.
    Download PHP DB Edit Toolkit for free. PHP DB Edit Toolkit is a set of PHP classes makes the generation of database edit interfaces easier and faster. The main class builds tabular and form views based on a data dictionary and takes over handling of insert/update/delete and user input.

    Comment

    • KAH

      #3
      Re: Session Errors

      Jochen Daum <jochen.daum@ca ns.co.nz> wrote in
      news:p4j1ov0ohl 4ruf0e0drmi41pj o36ghq4s4@4ax.c om:
      [color=blue]
      > 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.[/color]

      The safest way in my experience is to use session_destroy ()/unset().

      KAH

      Comment

      Working...