#36366 [NEW]: session is changed when assigning local vars with same name as session

From: Date: Sat, 11 Feb 2006 09:37:50 +0000
Subject: #36366 [NEW]: session is changed when assigning local vars with same name as session
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-93151@lists.php.net to get a copy of this message
From: flummi at everymail dot net Operating system: OSX PHP version: 4.4.2 PHP Bug Type: Session related Bug description: session is changed when assigning local vars with same name as session Description: ------------ I am assigning a session var $_SESSION['name'] and then assign a local var $name, which overwrites the first session var when I reload the page. NOTE: this bug only occours when reloading the page. It seams, that PHP has a reference $name = $_SESSION['name'] saved, the second time this script is executed. Am I missing anything?? Reproduce code: --------------- $_SESSION['name']=array("One","Two"); echo "Session 1:\n"; var_dump($_SESSION['name']); // the following line also changes $_SESSION['name'] // when the session was already set bevore (on reload) $name = array(); echo "Session 2:\n"; var_dump($_SESSION['name']); Expected result: ---------------- Session 1: array(2) { [0]=> string(3) "One" [1]=> string(3) "Two" } Session 2: array(2) { [0]=> string(3) "One" [1]=> string(3) "Two" } /* the above result is displayed the first time, but when I reload the page... */ Actual result: -------------- Session 1: array(2) { [0]=> string(3) "One" [1]=> string(3) "Two" } Session 2: array(0) { } /* on reload, the above output is given */ -- Edit bug report at http://bugs.php.net/?id=36366&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=36366&r=trysnapshot44 Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=36366&r=trysnapshot51 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=36366&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=36366&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=36366&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=36366&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=36366&r=needscript Try newer version: http://bugs.php.net/fix.php?id=36366&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=36366&r=support Expected behavior: http://bugs.php.net/fix.php?id=36366&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=36366&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=36366&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=36366&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=36366&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=36366&r=dst IIS Stability: http://bugs.php.net/fix.php?id=36366&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=36366&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=36366&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=36366&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=36366&r=mysqlcfg

« previous php.bugs (#93151) next »