summaryrefslogtreecommitdiff
path: root/ext/domxml/php_domxml.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/domxml/php_domxml.c')
-rw-r--r--ext/domxml/php_domxml.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/ext/domxml/php_domxml.c b/ext/domxml/php_domxml.c
index 5129825743..7dee8c69b1 100644
--- a/ext/domxml/php_domxml.c
+++ b/ext/domxml/php_domxml.c
@@ -2375,7 +2375,12 @@ PHP_FUNCTION(domxml_node_append_child)
php_error(E_WARNING, "%s(): can't append attribute node", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
-
+
+ if (!(child->doc == NULL || child->doc == parent->doc)) {
+ php_error(E_WARNING, "%s(): Can't append node, which is in a different document than the parent node", get_active_function_name(TSRMLS_C));
+ RETURN_FALSE;
+ }
+
/* first unlink node, if child is already a child of parent */
if (child->parent == parent){
xmlUnlinkNode(child);