note 31065 deleted from function.unset by sniper
| From: | sniper@php.net | Date: | Mon, 13 Oct 2003 02:28:31 +0000 |
| Subject: | note 31065 deleted from function.unset by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-58485@lists.php.net to get a copy of this message | ||
Note Submitter: the_mindflayer@operamail.com
----
Session variables and unset() do not mix.
Somewhere between v4.0.6 and v4.1.2 something seems to have changed with the way unset() affects
session variables. I may be totally wrong, but this is what I see.
--------------------------
session_register("ABCD");
if ( empty( $ABCD ) ) {
$ABCD = array();
}
// Miscellaneous nasty stuff going on in here...
// code code code, type type type
// We decide we want to clear the variable.
// (eg: login page and we want to reset permissions
// before we assign new ones)
unset($ABCD);
$ABCD = array();
--------------------------
At this point, in 4.0.6, $ABCD appears to be the session variable we defined earlier. Any changes
made to it WILL show up in the session.
At this point, in 4.1.2, $ABCD appears NOT to be the session variable we defined earlier. Any
changes made to it WILL NOT show up in the session.