note 27125 added to ref.session

From: Date: Sat, 23 Nov 2002 21:40:58 +0000
Subject: note 27125 added to ref.session
Groups: php.notes 
Request: Send a blank email to php-notes+get-39902@lists.php.net to get a copy of this message
I just noticed a strange behavior with php sessions. With register_globals = off I am using the $_SESSION array to capture and retrieve my session variables. When I have a variable in my script with the same name as an index in the $_SESSION array... $foo = "bar1"; $_SESSION["foo"] = "bar2"; I've noticed that at the end of the script, sessions first tries to write the contents of the $_SESSION array. unset( $_SESSION["foo"] ); If for some reason I unset the session variable "foo" from the $_SESSION array, sessions will then try to write the contents of $foo. ... next script that calls session sees... $_SESSION["foo"] = "bar1" This is bizzare. I already have a headache from this one. Hope this helps other people with their session problems! -- http://www.php.net/manual/en/ref.session.php http://master.php.net/manage/user-notes.php?action=edit+27125 http://master.php.net/manage/user-notes.php?action=delete+27125 http://master.php.net/manage/user-notes.php?action=reject+27125

« previous php.notes (#39902) next »