#42308 [Com]: objects and variable together in session mix up the $_SESSION

From: Date: Wed, 15 Aug 2007 13:01:17 +0000
Subject: #42308 [Com]: objects and variable together in session mix up the $_SESSION
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-116114@lists.php.net to get a copy of this message
ID: 42308 Comment by: domnulnopcea at yahoo dot com Reported By: domnuprofesor at yahoo dot com Status: Open Bug Type: Session related Operating System: Fedora Core 6 PHP Version: 4.4.7 New Comment: yes..i came across the same problem... I did not even put the object in $_SESSION and it was there!!!! Previous Comments: ------------------------------------------------------------------------ [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

« previous php.bugs (#116114) next »