#32496 [Opn->Bgs]: Session string values are references
| From: | sniper@php.net | Date: | Wed, 30 Mar 2005 05:25:39 +0000 |
| Subject: | #32496 [Opn->Bgs]: Session string values are references | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-76013@lists.php.net to get a copy of this message | ||
ID: 32496
Updated by: sniper@php.net
Reported By: ceo at l-i-e dot com
-Status: Open
+Status: Bogus
Bug Type: Session related
Operating System: FreeBSD 5.3-RELEASE
PHP Version: 5.0.3
New Comment:
Using latest CVS + register_globals = Off -> Works just fine.
Previous Comments:
------------------------------------------------------------------------
[2005-03-30 05:23:22] ceo at l-i-e dot com
Description:
------------
<?php
session_start();
if (!isset($_SESSION['name'])){
$_SESSION['name'] = 'Richard Lynch';
}
else{
$name = $_SESSION['name'];
}
/* Assume a ton of code goes here */
$name = 'Fooey';
echo "Session name is: ", $_SESSION['name'], "<br />\n";
?>
Now, hit this page, re-load it, and what do *YOU* expect
$_SESSION['name'] to output?
A) 'Richard Lynch', because you never re-assigned $_SESSION['name']
B) 'Fooey' because $name is a reference, and you changed it, so that
changed your session data.
*I* expected A)
Alas, the reality is B)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=32496&edit=1