|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-02-19 10:16 UTC] rafael at freshsite dot de
[2009-02-19 10:23 UTC] rafael at freshsite dot de
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 05:00:02 2025 UTC |
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) } }