diff options
-rw-r--r-- | ext/dom/php_dom.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/ext/dom/php_dom.c b/ext/dom/php_dom.c index d5738e1060..6bc72e9f97 100644 --- a/ext/dom/php_dom.c +++ b/ext/dom/php_dom.c @@ -1360,6 +1360,14 @@ xmlNode *dom_get_elements_by_tag_name_ns_raw(xmlNodePtr nodep, char *ns, char *l /* }}} */ /* }}} end dom_element_get_elements_by_tag_name_ns_raw */ +static inline zend_bool is_empty_node(xmlNodePtr nodep) +{ + xmlChar *strContent = xmlNodeGetContent(nodep); + zend_bool ret = strContent == NULL || *strContent == '\0'; + xmlFree(strContent); + return ret; +} + /* {{{ void dom_normalize (xmlNodePtr nodep) */ void dom_normalize (xmlNodePtr nodep) { @@ -1385,8 +1393,7 @@ void dom_normalize (xmlNodePtr nodep) break; } } - strContent = xmlNodeGetContent(child); - if (*strContent == '\0') { + if (is_empty_node(child)) { nextp = child->next; xmlUnlinkNode(child); php_libxml_node_free_resource(child); |