note 41187 added to function.session-decode
| From: | forum at orthanc dot co dot nz | Date: | Fri, 02 Apr 2004 05:26:06 +0000 |
| Subject: | note 41187 added to function.session-decode | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-67500@lists.php.net to get a copy of this message | ||
Becarful using this if you are trying to switch out of an existing session rather than load one into
a clean slate.
session_decode doesn't destroy the existing session data, it will over write it if there is a
session variable of the same name, but if the names don't clash the existing session variables
will hang around.
I have yet to find a better solution than
session_destroy()
session_start()
session_decode(....);
-----------------------------------------
To explain what I'm talking about
<?
session_start();
$a = 5;
session_register('a');
session_decode("<session that doesn't have a as a session variable>");
print (session_is_registered('a') ? $a : 'Not Registered' );
?>
The above code will print '5' as $a hasn't been destroyed or even unregistered by the
session_decode
----
Manual Page -- http://www.php.net/manual/en/function.session-decode.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+41187
Delete -- http://master.php.net/manage/user-notes.php?action=delete+41187&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+41187&report=yes
Search -- http://master.php.net/manage/user-notes.php