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

From: Date: Wed, 15 Aug 2007 12:43:49 +0000
Subject: #42308 [NEW]: objects and variable together in session mix up the $_SESSION
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-116111@lists.php.net to get a copy of this message
From: domnuprofesor at yahoo dot com Operating system: Fedora Core 6 PHP version: 4.4.7 PHP Bug Type: Session related Bug description: objects and variable together in session mix up the $_SESSION 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 bug report at http://bugs.php.net/?id=42308&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=42308&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=42308&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=42308&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=42308&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=42308&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=42308&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=42308&r=needscript Try newer version: http://bugs.php.net/fix.php?id=42308&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=42308&r=support Expected behavior: http://bugs.php.net/fix.php?id=42308&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=42308&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=42308&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=42308&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42308&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=42308&r=dst IIS Stability: http://bugs.php.net/fix.php?id=42308&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=42308&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=42308&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=42308&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=42308&r=mysqlcfg

« previous php.bugs (#116111) next »