#36898 [Opn->Asn]: __set() leaks memory

From: Date: Tue, 28 Mar 2006 20:22:34 +0000
Subject: #36898 [Opn->Asn]: __set() leaks memory
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-95026@lists.php.net to get a copy of this message
ID: 36898 Updated by: tony2001@php.net Reported By: bjori@php.net -Status: Open +Status: Assigned Bug Type: Scripting Engine problem Operating System: FreeBSD6 PHP Version: 5CVS-2006-03-28 (CVS) -Assigned To: +Assigned To: tony2001 New Comment: Not really engine problem, but overall design issue. I'll take care of it. Previous Comments: ------------------------------------------------------------------------ [2006-03-28 21:48:33] bjori@php.net Description: ------------ __set() seems to leak memory when extending internal classes (DOMElement for instance) Reproduce code: --------------- <?php class foo extends DOMElement { private $a = array(); public function __construct() { } public function __set($k, $v) { $this->a[$k] = $v; } } $obj = new foo; $obj->foo = "bar"; Actual result: -------------- [Tue Mar 28 21:45:10 2006] Script: 'element.php' /usr/src/php51/Zend/zend_object_handlers.c(292) : Freeing 0x08320364 (5 bytes), script=element.php /usr/src/php51/Zend/zend_hash.c(314) : Actual location (location was relayed) [Tue Mar 28 21:45:10 2006] Script: 'element.php' /usr/src/php51/Zend/zend_hash.c(307) : Freeing 0x08322B24 (39 bytes), script=element.php [Tue Mar 28 21:45:10 2006] Script: 'element.php' /usr/src/php51/Zend/zend_object_handlers.c(284) : Freeing 0x08322AA4 (32 bytes), script=element.php /usr/src/php51/Zend/zend_hash.c(169) : Actual location (location was relayed) [Tue Mar 28 21:45:10 2006] Script: 'element.php' /usr/src/php51/Zend/zend_object_handlers.c(283) : Freeing 0x08322A24 (44 bytes), script=element.php === Total 4 memory leaks detected === ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=36898&edit=1

« previous php.bugs (#95026) next »