Bug #61797 [Com]: DOMNode::appendChild doesn't increment refcount
| From: | beberlei@php.net | Date: | Sun, 22 Sep 2019 22:33:46 +0000 |
| Subject: | Bug #61797 [Com]: DOMNode::appendChild doesn't increment refcount | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-222877@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=61797&edit=1
ID: 61797
Comment by: beberlei@php.net
Reported by: kuba dot brecka at gmail dot com
Summary: DOMNode::appendChild doesn't increment refcount
Status: Wont fix
Type: Bug
Package: DOM XML related
Operating System: Windows, Linux
PHP Version: 5.4.0
Assigned To: beberlei
Block user comment: N
Private report: N
New Comment:
In addition, you should see childNodes, documentElement and other properties holding DOMNode and
subclasses as "magic" properties using __get, that return new instances as they like based
on the underlying libxml structure.
ext/dom makes *no* guarantee to keep references matching to individual libxml nodes. This strategy
is also used to keep memory usage low(er).
Previous Comments:
------------------------------------------------------------------------
[2019-09-22 22:10:20] beberlei@php.net
This is not a bug. DOMDocument guarantees you the return of a DOMElement from a childNode. If you
pass a subclass of DOMElement, then you must register is using "registerNodeClass". Not
doing so will only guarantee you a DOMElement, depending if original element fell out of scope.
------------------------------------------------------------------------
[2015-07-10 16:04:36] cmb@php.net
Related To: Bug #70026
------------------------------------------------------------------------
[2015-05-17 16:57:01] cmb@php.net
It appears to me that this is not a reference counting issue; at
least the additional zval_copy_ctor() leaks memory with a recent
master on Windows.
------------------------------------------------------------------------
[2013-12-03 07:45:44] krakjoe@php.net
The non-standard registerNodeClass exists to service the createElement functionality of the DOM,
there is no other logical reason for it's existence.
The patch doesn't change that, it enforces reference counting, which is required, everywhere.
------------------------------------------------------------------------
[2013-12-03 07:37:43] mike@php.net
Your patch reads like a bug fix, but reading it in context with the source it is not definitely a
bug. Why would you suggest registerNodeClass() exists?
If we change that, then obviously only for master.
But let's first try to reach an author for comment.
Rob?
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=61797
--
Edit this bug report at https://bugs.php.net/bug.php?id=61797&edit=1