php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #15276 Error with unset();
Submitted: 2002-01-29 10:07 UTC Modified: 2002-02-02 22:28 UTC
From: vvtk at stealthcomp dot com Assigned:
Status: Not a bug Package: Session related
PHP Version: 4.1.1 OS: RedHat 7.1
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: vvtk at stealthcomp dot com
New email:
PHP Version: OS:

 

 [2002-01-29 10:07 UTC] vvtk at stealthcomp dot com
Simple Script:
<?
session_id("TESTSESSION");
session_start();
session_register("TEXN_ARRAY");
echo $TEXN_ARRAY."<BR>";
unset($TEXNS_ARRAY);
$TEXN_ARRAY = "Value 1";
echo $TEXN_ARRAY."<BR>";
?>

After execution we have:

Value 1

Change line 7 to $TEXN_ARRAY = "Value 2";

After execution we have:
Value 1
Value 2

Change line 7 to $TEXN_ARRAY = "Value 3";

After execution we have:
Value 1 <-!!!!!!!!!!!! We expected Value 2 !!!
Value 3


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-02-02 22:28 UTC] yohgaki@php.net
Use session module as current manual explains.
Your script does not work as you expected.

You are not supposed to unset() session variable with unset().
Use session_unregister() for global session vars instead.

If you want to save session variable, don't unset().

 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue May 06 09:01:28 2025 UTC