Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
diff --git a/hphp/runtime/ext/domdocument/ext_domdocument.cpp b/hphp/runtime/ext/domdocument/ext_domdocument.cpp
index 6a35725..03e685f 100644
--- a/hphp/runtime/ext/domdocument/ext_domdocument.cpp
+++ b/hphp/runtime/ext/domdocument/ext_domdocument.cpp
@@ -2470,7 +2470,12 @@ Variant HHVM_METHOD(DOMNode, replaceChild,
xmlReplaceNode(oldchild, newchild);
dom_reconcile_ns(nodep->doc, newchild);
}
- return create_node_object(oldchild, data->doc(), false);
+
+ if (domnewchildnode->doc().get()) {
+ removeOrphanIfNeeded(*domnewchildnode->doc_data()->m_orphans,
+ domnewchildnode->m_node);
+ }
+ return create_node_object(oldchild, data->doc(), oldchild != newchild);
}
php_dom_throw_error(NOT_FOUND_ERR, data->doc_data()->m_stricterror);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.