|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
Patchesdom_node_append_child.patch (last revision 2013-12-02 19:55 UTC by krakjoe@php.net)Pull RequestsHistoryAllCommentsChangesGit/SVN commits
[2012-04-26 13:27 UTC] maarten@php.net
[2012-04-26 13:27 UTC] maarten@php.net
-Status: Open
+Status: Feedback
[2012-04-26 13:46 UTC] kuba dot brecka at gmail dot com
-Status: Feedback
+Status: Open
[2012-04-26 13:46 UTC] kuba dot brecka at gmail dot com
[2013-12-02 16:35 UTC] mike@php.net
-Type: Bug
+Type: Documentation Problem
[2013-12-02 19:43 UTC] krakjoe@php.net
[2013-12-02 19:44 UTC] krakjoe@php.net
[2013-12-02 19:55 UTC] krakjoe@php.net
[2013-12-02 19:57 UTC] krakjoe@php.net
[2013-12-03 00:26 UTC] bjori@php.net
-Type: Documentation Problem
+Type: Bug
[2013-12-03 00:26 UTC] bjori@php.net
[2013-12-03 07:37 UTC] mike@php.net
-Assigned To:
+Assigned To: rrichards
[2013-12-03 07:37 UTC] mike@php.net
[2013-12-03 07:45 UTC] krakjoe@php.net
[2015-05-17 16:57 UTC] cmb@php.net
[2017-10-24 06:14 UTC] kalle@php.net
-Status: Assigned
+Status: Open
-Assigned To: rrichards
+Assigned To:
[2019-09-22 22:10 UTC] beberlei@php.net
-Status: Open
+Status: Wont fix
[2019-09-22 22:10 UTC] beberlei@php.net
[2019-09-22 22:10 UTC] beberlei@php.net
-Assigned To:
+Assigned To: beberlei
[2019-09-22 22:33 UTC] beberlei@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 04:00:01 2025 UTC |
Description: ------------ When I create a DOM element and I add it via DOMDocument->appendChild, it seems that the refcount to that object is not increased. This causes the appended child to be deallocated if there are no other references. It also causes some funky behaviour, because the freed object can still be accesssed (doesn't) crash, but it seems to be of different type. Don't know the cause, maybe the memory gets either reused to create another object. I created a simple test case that proves and reproduces this buggy behaviour, AFAIK all PHP versions are affected, I tested 5.4.0 on Windows. Test script: --------------- class MyElement extends DOMElement { } // #1 - okay $dom = new DOMDocument(); $e = new MyElement("e"); $dom->appendChild($e); echo get_class($dom->childNodes->item(0)) . "\n"; // #2 - wrong $dom = new DOMDocument(); $dom->appendChild(new MyElement("e")); echo get_class($dom->childNodes->item(0)) . "\n"; // #3 - wrong $dom = new DOMDocument(); $e = new MyElement("e"); $dom->appendChild($e); $e = null; echo get_class($dom->childNodes->item(0)) . "\n"; Expected result: ---------------- MyElement MyElement MyElement Actual result: -------------- MyElement DOMElement DOMElement