#47448 [NEW]: corrupted referencing with $_SESSION

From: Date: Thu, 19 Feb 2009 10:06:20 +0000
Subject: #47448 [NEW]: corrupted referencing with $_SESSION
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-133991@lists.php.net to get a copy of this message
From: rafael at freshsite dot de Operating system: Mac OSX PHP version: 5.2.9RC2 PHP Bug Type: Unknown/Other Function Bug description: corrupted referencing with $_SESSION Description: ------------ $_SESSION['key'] (key) is changing when using $key in context. Seems only happening on Mac OSX, because the "expected result" (below) comes from linux php, the "actual result" comes out of a Mac machine. Reproduce code: --------------- <?php session_start(); class test{ public function get_data(){ $tmp = array( array('isadmin'=>1, 'test'=>0) ); $_SESSION['user'] = $tmp[0]; } } $tester = new test(); $tester->get_data(); var_dump($_SESSION); /* * Output (correct): array(1) { ["user"]=> &array(2) { ["isadmin"]=> int(1) ["test"]=> int(0) } } */ $user = array('isadmin'=>0, "test"=>1); var_dump($_SESSION); /* * Output (NOT correct): * array(1) { ["user"]=> &array(2) { ["isadmin"]=> int(0) ["test"]=> int(1) } } */ ?> Expected result: ---------------- array(1) { ["user"]=> array(2) { ["isadmin"]=> int(1) ["test"]=> int(0) } } array(1) { ["user"]=> array(2) { ["isadmin"]=> int(1) ["test"]=> int(0) } } Actual result: -------------- array(1) { ["user"]=> &array(2) { ["isadmin"]=> int(1) ["test"]=> int(0) } } array(1) { ["user"]=> &array(2) { ["admin"]=> int(0) ["test"]=> int(1) } } -- Edit bug report at http://bugs.php.net/?id=47448&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=47448&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=47448&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=47448&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=47448&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=47448&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=47448&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=47448&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=47448&r=needscript Try newer version: http://bugs.php.net/fix.php?id=47448&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=47448&r=support Expected behavior: http://bugs.php.net/fix.php?id=47448&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=47448&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=47448&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=47448&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=47448&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=47448&r=dst IIS Stability: http://bugs.php.net/fix.php?id=47448&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=47448&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=47448&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=47448&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=47448&r=mysqlcfg

« previous php.bugs (#133991) next »