From efec22b7bedfb1eae2df72b84cf5ad229e0bdc1e Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Wed, 11 Mar 2020 13:02:09 +0100 Subject: Fix #78221: DOMNode::normalize() doesn't remove empty text nodes If a text node is not followed by another text node, we remove it, if its textContent is empty. --- ext/dom/php_dom.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'ext/dom/php_dom.c') diff --git a/ext/dom/php_dom.c b/ext/dom/php_dom.c index 72ae3c3ffe..ed67f047fa 100644 --- a/ext/dom/php_dom.c +++ b/ext/dom/php_dom.c @@ -1383,6 +1383,14 @@ void dom_normalize (xmlNodePtr nodep) break; } } + strContent = xmlNodeGetContent(child); + if (*strContent == '\0') { + nextp = child->next; + xmlUnlinkNode(child); + php_libxml_node_free_resource(child); + child = nextp; + continue; + } break; case XML_ELEMENT_NODE: dom_normalize (child); -- cgit v1.2.1