#42308 [Opn->Bgs]: objects and variable together in session mix up the $_SESSION
| From: | johannes@php.net | Date: | Wed, 15 Aug 2007 17:24:54 +0000 |
| Subject: | #42308 [Opn->Bgs]: objects and variable together in session mix up the $_SESSION | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-116130@lists.php.net to get a copy of this message | ||
ID: 42308
Updated by: johannes@php.net
Reported By: domnuprofesor at yahoo dot com
-Status: Open
+Status: Bogus
Bug Type: Session related
Operating System: Fedora Core 6
PHP Version: 4.4.7
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
Looks like register_globals is activated on your host. Please see the
documentation for more information about register_globals.
Previous Comments:
------------------------------------------------------------------------
[2007-08-15 13:01:17] domnulnopcea at yahoo dot com
yes..i came across the same problem...
I did not even put the object in $_SESSION and it was there!!!!
------------------------------------------------------------------------
[2007-08-15 12:43:49] domnuprofesor at yahoo dot com
Description:
------------
I came across this situation:
I had and object named "grid" which was a wrapper for a table.
In $_SESSION I already had a mysql singleton wrapper.
I tried to set another session variable with the key "grid1" and value,
lets say "text". The result I got was that PHP loaded the object "grid1"
in $_SESSION.
After I changed the key name, let say "grid1_text" I got the expected
results!
Reproduce code:
---------------
$grid1 = new GridPrototype();
$grid1->setPerPage(4);
$grid1->setID("1");
$grid1->setKey();
$id = "1";
$key = "grid" . $id;
$_SESSION[$key] = $status;
Expected result:
----------------
I expect to have the $status variable accessible via $_SESSION['grid1']
Actual result:
--------------
$_SESSION['grid1'] points to the object $grid1
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=42308&edit=1