ID:               26765
 Updated by:       [EMAIL PROTECTED]
 Reported By:      alex_mailbox53 at yahoo dot com
 Status:           Critical
 Bug Type:         Zend Engine 2 problem
 Operating System: *
-PHP Version:      5CVS
+PHP Version:      5CVS-2004-02-05
 New Comment:

Latest CVS checkout of HEAD today doesn't show any leaks anymore, but
the output is still incorrect. (or it's incorrect with PHP 4, who knows
:).

And changing that var_dump() -> print_r() causes segfault..



Previous Comments:
------------------------------------------------------------------------

[2004-01-11 10:46:12] [EMAIL PROTECTED]

I played around and tested what happens with PHP 4..this has nothing to
do with serialization, following works fine
in PHP 4, in PHP 5 it causes several memleaks and the resulting object
is not quite correct:

<?php

class SFTemplate { 
    var $content; 
    var $parent; 

    function SFTemplate() {
        $this->content = new SFTemplateContent($this);
    } 
} 

class SFTemplateContent { 
    var $template; 
    var $items  = array(); 

    function SFTemplateContent($tpl) {
        $this->template = $tpl;
    } 

    function add($item) { 
        $this->items[] = $item; 
        $item->parent = $this->template; 
    } 
} 

$t = new SFTemplate(); 

$t->content->add(new SFTemplate()); 

var_dump($t);

?>


------------------------------------------------------------------------

[2004-01-02 07:15:15] alex_mailbox53 at yahoo dot com

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 this bug report at http://bugs.php.net/?id=26765&edit=1

Reply via email to