Yes. I've thought about serializing, but I suspect handling session already uses serializing to keep objects or whatever. It doesn't work out for me. Maybe because of bugs or features in the function serialize(). This is a simple example:
<body>
<? class ctest {
var $items;
function add_item($item){ $this->items[] = $item; }
}
class ctest2 {
var $name;
function null(){}
}
$test = new ctest;
$test2 = new ctest2; $test2->name = "WOW";
$test->add_item($test2);
echo serialize($test) . "<br>";
$test->items[0]->null(); // SIC!
//After calling null function the agregated
//object is empty!!!
echo serialize($test);
?>
</body>
As result I see
O:5:"ctest":1:{s:5:"items";a:1:{i:0;O:6:"ctest2":1:{s:4:"name";s:3:"WOW";}}}
O:5:"ctest":1:{s:5:"items";a:1:{}}
version is 4.0.3pl1
Do you see the same?
Moreover, it doesn't work for referenced agregated objects.