Bug #11527 Updated: session_unregister() seems not work properly
| From: | ccjeagle at ms6 dot hinet dot net | Date: | Mon, 18 Jun 2001 01:41:40 +0000 |
| Subject: | Bug #11527 Updated: session_unregister() seems not work properly | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-56776@lists.php.net to get a copy of this message | ||
ID: 11527
User Update by: ccjeagle@ms6.hinet.net
Status: Open
Bug Type: *Session related
Operating system: FreeBSD 4.3 STABLE
PHP Version: 4.0.5
Description: session_unregister() seems not work properly
Well I found a solution. Just replace session_unregister()
by unset() statement.
Previous Comments:
---------------------------------------------------------------------------
[2001-06-17 20:06:04] ccjeagle@ms6.hinet.net
It seems that session_unregister() should "remove" a var
from the session, isn't it ?
-------test.php
<?php
// First script, register the var
session_start() ;
session_register("somevar") ;
$HTTP_SESSION_VARS["somevar"] = "abc" ;
?>
<a href="test2.php">Click Here</a>
-------test2.php
<?php
// Second script, unregister the var
session_start() ;
echo "somevar is " . $HTTP_SESSION_VARS["somevar"] ;
session_unregister("somevar") ;
?>
<br><a href="test3.php">Click here again</a>
--------test3.php
<?php
// The third script, see the result
session_start() ;
print_r($HTTP_SESSION_VARS) ;
session_unset() ;
print_r($HTTP_SESSION_VARS) ;
session_destroy() ;
?>
With the enable-trans-sid turned on, the result of the third
script is :
Array ( [somevar] => abc ) Array ( )
Is it a bug ?
How shoud I do if I want to "remove" some variables from
session but KEEP THE OTHERS unchanged ?
Best Regards
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=11527