#28966 [Csd->Bgs]: Session var is overwritten by regular var of same name
| From: | derick@php.net | Date: | Wed, 30 Jun 2004 15:29:35 +0000 |
| Subject: | #28966 [Csd->Bgs]: Session var is overwritten by regular var of same name | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-61563@lists.php.net to get a copy of this message | ||
ID: 28966
Updated by: derick@php.net
Reported By: dgoodman at twentythreeg dot net
-Status: Closed
+Status: Bogus
Bug Type: Session related
Operating System: Debian/Linux 2.6.5
PHP Version: 4.3.7
New Comment:
And that's why we used the quick fix that this didn't imply a bug in
PHP and pointed you to resources on how to obtain further help.
Previous Comments:
------------------------------------------------------------------------
[2004-06-30 17:28:14] dgoodman at twentythreeg dot net
My apologies...
Somehow register_globals was turned on when I could have sworn it was
turned off. Sorry to waste your time.
------------------------------------------------------------------------
[2004-06-30 16:53:23] dgoodman at twentythreeg dot net
Certainly seems like a bug to me. I wasn't asking for support. Please
explain how this is does not imply a problem with PHP.
If I assign a value to the session variable, I don't expect to be able
to overwrite the value of that variable with a completely unrelated
variable. Please recheck this issue.
------------------------------------------------------------------------
[2004-06-30 09:08:23] derick@php.net
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions.
Thank you for your interest in PHP.
.
------------------------------------------------------------------------
[2004-06-30 00:52:23] dgoodman at twentythreeg dot net
Description:
------------
If I save a variable to $_SESSION, for example $_SESSION['varname'] =
'value', and then assign a value to a normal variable of the same name,
$varname = 'value2', then the value of the session variable is
overwritten with the second value.
This is not an issue of assignment by reference -- I assign values, as
shown in the code I have provided.
The first time the code is executed, the results are correct on my
machine. However, on subsequent executions of the code, the results
become incorrect.
Reproduce code:
---------------
<?PHP
session_start();
$_SESSION['var'] = 'Foo';
print 'Session.var = '.$_SESSION['var'].'<BR>';
$var = 'Bar';
print 'var = '.$var.'<BR>';
$var1 = $_SESSION['var'];
print 'var1 = '.$var1.'<BR>';
?>
Expected result:
----------------
Session.var = Foo
var = Bar
var1 = Foo
Actual result:
--------------
Session.var = Foo
var = Bar
var1 = Bar
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28966&edit=1