note 51103 added to language.oop.serialization

From: Date: Sun, 20 Mar 2005 01:43:59 +0000
Subject: note 51103 added to language.oop.serialization
Groups: php.notes 
Request: Send a blank email to php-notes+get-86699@lists.php.net to get a copy of this message
It seems that serializing an object dereferences all its attributes that were references - even if the object they referenced was contained within the serialized one. Consider this example: <? class foo { var $a=new array(); } $example=new foo; $obj=new whatever(); $example->a[]=&$obj; $example->a[]=$obj; //now $example contains a list with //both: an object and a reference to that object //let us serialize and immediately unserialize $example: $string=serialize(example); $example=unserialize(string); //now the situation is completely different! //$example contains just two identical objects, //the reference is lost ?> ---- Manual Page -- http://www.php.net/manual/en/language.oop.serialization.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+51103 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+51103&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+51103&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+51103&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+51103&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+51103&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+51103&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#86699) next »