#36366 [Opn->Bgs]: session is changed when assigning local vars with same name as session
| From: | tony2001@php.net | Date: | Sat, 11 Feb 2006 10:22:03 +0000 |
| Subject: | #36366 [Opn->Bgs]: session is changed when assigning local vars with same name as session | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-93152@lists.php.net to get a copy of this message | ||
ID: 36366
Updated by: tony2001@php.net
Reported By: flummi at everymail dot net
-Status: Open
+Status: Bogus
Bug Type: Session related
Operating System: OSX
PHP Version: 4.4.2
New Comment:
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
Turn off register_globals if you don't want this behaviour.
Previous Comments:
------------------------------------------------------------------------
[2006-02-11 10:37:48] flummi at everymail dot net
Description:
------------
I am assigning a session var $_SESSION['name'] and then assign a local
var $name, which overwrites the first session var when I reload the
page.
NOTE: this bug only occours when reloading the page. It seams, that PHP
has a reference $name = $_SESSION['name'] saved, the second time this
script is executed. Am I missing anything??
Reproduce code:
---------------
$_SESSION['name']=array("One","Two");
echo "Session 1:\n";
var_dump($_SESSION['name']);
// the following line also changes $_SESSION['name']
// when the session was already set bevore (on reload)
$name = array();
echo "Session 2:\n";
var_dump($_SESSION['name']);
Expected result:
----------------
Session 1: array(2) { [0]=> string(3) "One" [1]=> string(3) "Two" }
Session 2: array(2) { [0]=> string(3) "One" [1]=> string(3) "Two" }
/* the above result is displayed the first time, but when I reload the
page... */
Actual result:
--------------
Session 1: array(2) { [0]=> string(3) "One" [1]=> string(3) "Two" }
Session 2: array(0) { }
/* on reload, the above output is given */
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=36366&edit=1