From: alex_mailbox53 at yahoo dot com
Operating system: Gentoo Linux
PHP version: 5.0.0b3 (beta3)
PHP Bug Type: Class/Object related
Bug description: Unserialize serialized object does not return object
Description:
------------
The following code displays only one serialized object, but
should display two:
class SFTemplate {
public $content;
public $parent;
function __construct() { $this->content = new
SFTemplateContent($this); }
}
class SFTemplateContent {
protected $template;
protected $items = array();
function __construct($tpl) { $this->template = $tpl; }
function add($item) {
$this->items[] = $item;
$item->parent = $this->template;
}
}
$t = new SFTemplate();
$t->content->add(new SFTemplate());
print_r(unserialize(serialize($t)));
print '<hr>';
$t->content->add(new SFTemplate());
print_r(unserialize(serialize($t)));
Adding more objects to SFTemplateContent object prevents
object from deserialization. With 1 object in items array it works
ok.
Expected result:
----------------
two dumps of deserialized objects
Actual result:
--------------
one dump
--
Edit bug report at http://bugs.php.net/?id=26765&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=26765&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=26765&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=26765&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=26765&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=26765&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=26765&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=26765&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=26765&r=support
Expected behavior: http://bugs.php.net/fix.php?id=26765&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=26765&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=26765&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=26765&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26765&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=26765&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=26765&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=26765&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=26765&r=float