From: Christian Stocker Date: Mon, 6 Jan 2003 08:48:38 +0000 (+0000) Subject: partly MFH from 1.288 (Fixed segfault, when trying to add a node to itself) X-Git-Tag: PHP_4_3_before_13561_fix~117 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1fcbd36e6df7ea5797e8c86dfb9b1c49aa343b06;p=php partly MFH from 1.288 (Fixed segfault, when trying to add a node to itself) --- diff --git a/ext/domxml/php_domxml.c b/ext/domxml/php_domxml.c index 0a58581316..38b407d186 100644 --- a/ext/domxml/php_domxml.c +++ b/ext/domxml/php_domxml.c @@ -2296,6 +2296,12 @@ PHP_FUNCTION(domxml_node_append_child) php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't append attribute node"); RETURN_FALSE; } + + /* XXX:ls */ + if (child == parent) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't append node to itself"); + RETURN_FALSE; + } if (!(child->doc == NULL || child->doc == parent->doc)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't append node, which is in a different document than the parent node");