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-2004-02-08
New Comment:
The leaks are caused by circular references. So the only
remaining issue is the segfault bug.
Perhaps related to bug #25975
Previous Comments:
------------------------------------------------------------------------
[2004-02-08 11:51:51] [EMAIL PROTECTED]
Here is the backtrace when print_r() is used:
[Switching to Thread 16384 (LWP 27314)]
0x082cd5a8 in zend_std_compare_objects (o1=0x40e4306c, o2=0xbfffd580)
at /usr/src/web/php/php5/Zend/zend_object_handlers.c:843
843 if (zobj1->ce != zobj2->ce) {
(gdb) bt
#0 0x082cd5a8 in zend_std_compare_objects (o1=0x40e4306c,
o2=0xbfffd580)
at /usr/src/web/php/php5/Zend/zend_object_handlers.c:843
#1 0x082bba58 in zend_print_zval_r_ex (write_func=0x8285769
<php_body_write_wrapper>, expr=0x40e4306c, indent=0)
at /usr/src/web/php/php5/Zend/zend.c:366
#2 0x082bb99b in zend_print_zval_r (expr=0x40e4306c, indent=0) at
/usr/src/web/php/php5/Zend/zend.c:342
#3 0x0820b566 in zif_print_r (ht=1, return_value=0x40e439d4,
this_ptr=0x0, return_value_used=0)
at /usr/src/web/php/php5/ext/standard/basic_functions.c:2570
#4 0x082dd654 in zend_do_fcall_common_helper (execute_data=0xbfffd7c0,
opline=0x40e42f54, op_array=0x40e42674)
at /usr/src/web/php/php5/Zend/zend_execute.c:2558
#5 0x082ddc8a in zend_do_fcall_handler (execute_data=0xbfffd7c0,
opline=0x40e42f54, op_array=0x40e42674)
at /usr/src/web/php/php5/Zend/zend_execute.c:2700
#6 0x082da498 in execute (op_array=0x40e42674) at
/usr/src/web/php/php5/Zend/zend_execute.c:1272
#7 0x082bcad3 in zend_execute_scripts (type=8, retval=0x0,
file_count=3) at /usr/src/web/php/php5/Zend/zend.c:1051
#8 0x08285fd8 in php_execute_script (primary_file=0xbffffbc0) at
/usr/src/web/php/php5/main/main.c:1641
#9 0x080b776c in main (argc=2, argv=0xbffffc54) at
/usr/src/web/php/php5/sapi/cli/php_cli.c:941
------------------------------------------------------------------------
[2004-02-04 20:42:09] [EMAIL PROTECTED]
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..
------------------------------------------------------------------------
[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