summaryrefslogtreecommitdiff
path: root/ext/dom/node.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/dom/node.c')
-rw-r--r--ext/dom/node.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/ext/dom/node.c b/ext/dom/node.c
index 8a581baa19..cba2f80b54 100644
--- a/ext/dom/node.c
+++ b/ext/dom/node.c
@@ -1134,7 +1134,9 @@ PHP_FUNCTION(dom_node_replace_child)
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);