php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #11569 session_register() not working after session_unset(); session_destroy();
Submitted: 2001-06-19 19:47 UTC Modified: 2001-07-10 05:35 UTC
From: antipode at thpoon dot com Assigned:
Status: Closed Package: Session related
PHP Version: 4.0.5 OS: Solaris 8 / Sparc
Private report: No CVE-ID: None
 [2001-06-19 19:47 UTC] antipode at thpoon dot com
I adopted most of this little script from user feedback in
the session_unset()'s annotations.  I ran into the same
problem, and think that it demonstrates it well.

<?php
function
dummy()
{
    global $a;
    session_unset();
    $a= 'foo';
    echo "<br>2. ".session_register('a');
}
session_start();
$a= 'foo';
session_register('a');
echo "<br>1. $a";
dummy();
echo "<br>3. $a";
?>

If you run it, you'll see that, even though the second 
session_register() returns TRUE, $a is not registered again,
and remains unset.

This bug does not allow me to be paranoid enough coding a
login-protected website.

Thanks.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-07-10 05:35 UTC] sas@php.net
session_unset() will delete the variables from the global scope. So, instead of

global $a;
session_unset();
$a = "foo";

you need to use this:

session_unset();
global $a; # establish link to global variable
$a = "foo";
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 12:01:31 2024 UTC