]> granicus.if.org Git - php/commitdiff
partly MFH from 1.288 (Fixed segfault, when trying to add a node to itself)
authorChristian Stocker <chregu@php.net>
Mon, 6 Jan 2003 08:48:38 +0000 (08:48 +0000)
committerChristian Stocker <chregu@php.net>
Mon, 6 Jan 2003 08:48:38 +0000 (08:48 +0000)
ext/domxml/php_domxml.c

index 0a58581316afe9d2e743dd494e973b9be183c07e..38b407d186324e87dc1955b91793dc0b2db98bd5 100644 (file)
@@ -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");