php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36898 __set() leaks memory
Submitted: 2006-03-28 21:48 UTC Modified: 2006-03-29 17:19 UTC
From: bjori@php.net Assigned: tony2001
Status: Closed Package: Scripting Engine problem
PHP Version: 5CVS-2006-03-28 (CVS) OS: FreeBSD6
Private report: No CVE-ID:
 [2006-03-28 21:48 UTC] 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 ===

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-03-28 22:22 UTC] tony2001@php.net
Not really engine problem, but overall design issue.
I'll take care of it.
 [2006-03-29 17:19 UTC] tony2001@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Fri Apr 18 20:01:57 2014 UTC