diff options
author | Rob Richards <rrichards@php.net> | 2003-08-20 18:58:03 +0000 |
---|---|---|
committer | Rob Richards <rrichards@php.net> | 2003-08-20 18:58:03 +0000 |
commit | d7e6bdaa0f5e274c07c38fca6ebfe791b3f19f3c (patch) | |
tree | 722d7ca232d52987383356d187eddf279adaf7bf /ext/dom/php_dom.c | |
parent | 20a878dc60db10d9b9d9d5739cbd82eb4cd21fc0 (diff) | |
download | php-git-d7e6bdaa0f5e274c07c38fca6ebfe791b3f19f3c.tar.gz |
fix infinite loop in normalize
Diffstat (limited to 'ext/dom/php_dom.c')
-rw-r--r-- | ext/dom/php_dom.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/ext/dom/php_dom.c b/ext/dom/php_dom.c index 11f7f9684b..fd62a925c2 100644 --- a/ext/dom/php_dom.c +++ b/ext/dom/php_dom.c @@ -1122,7 +1122,7 @@ void dom_get_elements_by_tag_name_ns_raw(xmlNodePtr nodep, char *ns, char *local /* {{{ void dom_normalize (xmlNodePtr nodep TSRMLS_DC) */ void dom_normalize (xmlNodePtr nodep TSRMLS_DC) { - xmlNodePtr child, nextp; + xmlNodePtr child, nextp, newnextp; xmlAttrPtr attr; xmlChar *strContent; @@ -1133,12 +1133,15 @@ void dom_normalize (xmlNodePtr nodep TSRMLS_DC) nextp = child->next; while (nextp != NULL) { if (nextp->type == XML_TEXT_NODE) { + newnextp = nextp->next; strContent = xmlNodeGetContent(nextp); xmlNodeAddContent(child, strContent); xmlFree(strContent); xmlUnlinkNode(nextp); node_free_resource(nextp TSRMLS_CC); - nextp = child->next; + nextp = newnextp; + } else { + break; } } break; |