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
 [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-2024 The PHP Group
All rights reserved.
Last updated: Fri Nov 08 10:01:28 2024 UTC