Bug #80600 [Asn->Csd]: DOMChildNode::remove() doesn't work on CharacterData nodes

From: Date: Tue, 02 Feb 2021 19:31:00 +0000
Subject: Bug #80600 [Asn->Csd]: DOMChildNode::remove() doesn't work on CharacterData nodes
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-231895@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80600&edit=1 ID: 80600 Updated by: beberlei@php.net Reported by: jules dot bernable at gmail dot com Summary: DOMChildNode::remove() doesn't work on CharacterData nodes -Status: Assigned +Status: Closed Type: Bug Package: DOM XML related Operating System: debian PHP Version: 8.0.0 Assigned To: beberlei Block user comment: N Private report: N New Comment: Automatic comment on behalf of kontakt@beberlei.de Revision: http://git.php.net/?p=php-src.git;a=commit;h=665e1f324a543bd04bcdd8dec089b82091c61671 Log: Fix bug #80600 DOMChildNode::remove does not work on DOMCharacterData. Previous Comments: ------------------------------------------------------------------------ [2021-02-01 22:14:37] beberlei@php.net The following pull request has been associated: Patch Name: Fix bug #80600 DOMChildNode::remove does not work on DOMCharacterData. On GitHub: https://github.com/php/php-src/pull/6660 Patch: https://github.com/php/php-src/pull/6660.patch ------------------------------------------------------------------------ [2021-01-07 09:42:00] beberlei@php.net confirmed, also for other nodes that extend DOMCharacterData. DOMCharacterData::remove does not seem to use dom_child_node_remove helper function that was added at some point, but the code looks the same and correct anyways. Probably a mistake in the assumptions how DOMCharacterData nodes fit into libxml hierarchy. I will look into this over the next days. ------------------------------------------------------------------------ [2021-01-06 19:55:52] jules dot bernable at gmail dot com Description: ------------ CharacterData nodes implement the new DomChildNode interface, but the DOMChildNode::remove() method doesn't work. See the provided test script. Text, comments and CDATA nodes should be removed. They are not. Test script: --------------- <php $doc = new \DOMDocument(); $doc->loadXML('<a>foo</a>'); $doc->documentElement->firstChild->remove(); echo $doc->saveXML($doc->documentElement); Expected result: ---------------- <a></a> Actual result: -------------- <a>foo</a> ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=80600&edit=1

« previous php.bugs (#231895) next »