note 31065 added to function.unset
| From: | the_mindflayer at operamail dot com | Date: | Tue, 08 Apr 2003 20:00:43 +0000 |
| Subject: | note 31065 added to function.unset | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-46367@lists.php.net to get a copy of this message | ||
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.
--
http://www.php.net/manual/en/function.unset.php
http://master.php.net/manage/user-notes.php?action=edit+31065
http://master.php.net/manage/user-notes.php?action=delete+31065
http://master.php.net/manage/user-notes.php?action=reject+31065