I have recently found a bug, that simple I can't explain. It should not be so hard, because is a very simple problem, but seems that I don't know something about PHP that makes this happend.
Let's take this simple code:
session_start();
$temp = new stdClass;
$temp->id = 1;
$temp->name = "A";
$_SESSION['temp_obj'] = $temp;
$data = new stdClass;
$data->temp = $_SESSION['temp_obj'];
$data->temp->name = 'B';
print_r($_SESSION['temp_obj']);
The output, should say:
stdClass Object ( [id] => 1 [name] => A )
But instead, it says...
stdClass Object ( [id] => 1 [name] => B )
So, the $_SESSION, has been changed, and nothing in the code has a...
$_SESSION['temp_obj'] = $data->temp;
So it shouldn't never overwrite the $_SESSION value. Furthermore, it also overwrites the $temp variable.
I can't see the error.