rrichards Mon Apr 18 19:07:50 2005 EDT Modified files: /php-src/ext/dom node.c /php-src/ext/dom/tests bug32615.phpt Log: Fix bug #32755 Segfault in replaceChild() when DocumentFragment has no children update test http://cvs.php.net/diff.php/php-src/ext/dom/node.c?r1=1.33&r2=1.34&ty=u Index: php-src/ext/dom/node.c diff -u php-src/ext/dom/node.c:1.33 php-src/ext/dom/node.c:1.34 --- php-src/ext/dom/node.c:1.33 Fri Apr 8 11:58:22 2005 +++ php-src/ext/dom/node.c Mon Apr 18 19:07:49 2005 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: node.c,v 1.33 2005/04/08 15:58:22 rrichards Exp $ */ +/* $Id: node.c,v 1.34 2005/04/18 23:07:49 rrichards Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -1134,7 +1134,9 @@ xmlUnlinkNode(oldchild); newchild = _php_dom_insert_fragment(nodep, prevsib, nextsib, newchild, intern, newchildobj TSRMLS_CC); - dom_reconcile_ns(nodep->doc, newchild); + if (newchild) { + dom_reconcile_ns(nodep->doc, newchild); + } } else if (oldchild != newchild) { if (newchild->doc == NULL && nodep->doc != NULL) { xmlSetTreeDoc(newchild, nodep->doc); http://cvs.php.net/diff.php/php-src/ext/dom/tests/bug32615.phpt?r1=1.1&r2=1.2&ty=u Index: php-src/ext/dom/tests/bug32615.phpt diff -u php-src/ext/dom/tests/bug32615.phpt:1.1 php-src/ext/dom/tests/bug32615.phpt:1.2 --- php-src/ext/dom/tests/bug32615.phpt:1.1 Fri Apr 8 11:58:24 2005 +++ php-src/ext/dom/tests/bug32615.phpt Mon Apr 18 19:07:50 2005 @@ -62,6 +62,12 @@ $frag->appendChild(new DOMElement('third')); $root->insertBefore($frag, $node); +echo $dom->saveXML()."\n"; + +$frag = $dom->createDocumentFragment(); +$root = $dom->documentElement; +$root->replaceChild($frag, $root->firstChild); + echo $dom->saveXML(); ?> @@ -73,3 +79,6 @@ <?xml version="1.0"?> <root><first/><second/><third/><fourth/></root> +<?xml version="1.0"?> +<root><second/><third/><fourth/></root> +
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php