ID: 47448
User updated by: rafael at freshsite dot de
Reported By: rafael at freshsite dot de
Status: Open
-Bug Type: Unknown/Other Function
+Bug Type: Session related
Operating System: Mac OSX
PHP Version: 5.2.9RC2
New Comment:
Edit: moved to "Session related"
Previous Comments:
------------------------------------------------------------------------
[2009-02-19 10:06:20] rafael at freshsite dot de
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 this bug report at http://bugs.php.net/?id=47448&edit=1