php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18996 Can't unset() the session variables
Submitted: 2002-08-20 16:49 UTC Modified: 2002-09-21 01:58 UTC
Votes:9
Avg. Score:4.2 ± 0.6
Reproduced:9 of 9 (100.0%)
Same Version:2 (22.2%)
Same OS:2 (22.2%)
From: frank at orite dot com Assigned:
Status: No Feedback Package: Session related
PHP Version: 4.2.2 OS: Redhat Linux 7.3
Private report: No CVE-ID: None
 [2002-08-20 16:49 UTC] frank at orite dot com
Apache/1.3.23 (Unix)  (Red-Hat/Linux)

register_globals = Off

[Session]
session.save_handler = files
session.save_path = /tmp
session.use_cookies = 1
session.name = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.serialize_handler = php
session.gc_probability = 1
session.gc_maxlifetime = 1440
session.referer_check =
session.entropy_length = 0
session.entropy_file =
;session.entropy_length = 16
;session.entropy_file = /dev/urandom
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 1
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"

I was trying to test the session via two pages, test.php and test2.php. Following are the scripts and results come up:

test.php
<?php
session_start();
$_SESSION["user"]="foo";
echo "set:".$_SESSION["user"];
unset($_SESSION);
echo "<br>unset:".@$_SESSION["user"];
?>

result on page:
set:foo
unset:

test2.php
<?php
session_start();
echo "set:".$_SESSION["user"];
echo "<br>unset:".@$_SESSION["user"];
?>

result on page:
set:foo
unset:foo

I've also tried to put up a session_destory() in test.php, that helps to unset the variable, but simply the session no longer exists.

Does anyone has the same problem, or any answers to this issue?

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-08-20 17:24 UTC] frank at orite dot com
I have same problem on my Windows Machine running IIS 5.1 PHP 4.2.2 as well.
 [2002-08-20 18:07 UTC] frank at orite dot com
Actually I can unset the variables without problem by using session_unregister() or session_unset();

However from the PHP Manual, these two functions are defered as:

Note: If $_SESSION (or $HTTP_SESSION_VARS for PHP 4.0.6 or less) is used, use unset() to unregister a session variable. 

Caution 
If you are using $HTTP_SESSION_VARS/$_SESSION and disable register_globals, do not use session_register(), session_is_registered() and session_unregister().
 [2002-08-20 19:03 UTC] kalowsky@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.


 [2002-08-21 01:47 UTC] frank at orite dot com
I've tried the snapshot just now, this problem still persists.
 [2002-08-21 01:59 UTC] kalowsky@php.net
You tried the stable or the unstable snapshot?

This is only in the unstable snapshot.  
 [2002-09-21 01:58 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 05 19:01:30 2024 UTC