php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47065 function session_unset() reset local variables
Submitted: 2009-01-11 08:37 UTC Modified: 2009-01-12 06:48 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: opurahman at gmail dot com Assigned:
Status: Not a bug Package: Session related
PHP Version: 5.2.8 OS: Linux
Private report: No CVE-ID: None
 [2009-01-11 08:37 UTC] opurahman at gmail dot com
Description:
------------
function session_unset() reset local variables.
I was trying to reset session variables after storing two values from session. It reset my local variables. Lets take a look into the codes bellow.

Reproduce code:
---------------
session_start();
$message = sprintf('%s', $_SESSION['message']);

echo('Here Message: # ' . $message . '<br />');

session_unset();

echo('Here Message: # ' . $message . '<br />'); // in this line, the variable $message has been unset.

Expected result:
----------------
It should display the value of $message


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-01-11 22:31 UTC] johannes@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php


Note: If $_SESSION (or $HTTP_SESSION_VARS  for PHP 4.0.6 or less) is used, use unset() to unregister a session variable, i.e. unset ($_SESSION[\'varname\']);. 

session_unset() is to be ued when using register_globals() which is not advised.
 [2009-01-12 06:48 UTC] opurahman at gmail dot com
OK then delete this topic please.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 15 23:01:33 2025 UTC