]> granicus.if.org Git - php/commitdiff
- fix for bug #17771 (insert_before misbeaviour (DOM L2 spec.))
authorChristian Stocker <chregu@php.net>
Wed, 14 Aug 2002 16:12:18 +0000 (16:12 +0000)
committerChristian Stocker <chregu@php.net>
Wed, 14 Aug 2002 16:12:18 +0000 (16:12 +0000)
@ - DomNode->insert_before behaves now according to W3C spec
@   ie. new_child is moved, not copied. (chregu)

ext/domxml/php_domxml.c

index f8c4c7508afbff6e4d911911e6dc7143955cf244..b95306753ec9ca27ad12d390fbe3aa49b397cd39 100644 (file)
@@ -2453,19 +2453,14 @@ PHP_FUNCTION(domxml_node_insert_before)
        DOMXML_GET_OBJ(child, node, le_domxmlnodep);
        DOMXML_GET_OBJ(refp, ref, le_domxmlnodep);
 
-       if (NULL == (new_child = xmlCopyNode(child, 1))) {
-               php_error(E_WARNING, "%s(): unable to clone node", get_active_function_name(TSRMLS_C));
-               RETURN_FALSE;
-       }
+       new_child = xmlAddPrevSibling(refp, child);
 
-       child = xmlAddPrevSibling(refp, new_child);
-
-       if (NULL == child) {
+       if (NULL == new_child) {
                php_error(E_WARNING, "%s(): couldn't add newnode as the previous sibling of refnode", get_active_function_name(TSRMLS_C));
                RETURN_FALSE;
        }
 
-       DOMXML_RET_OBJ(rv, child, &ret);
+       DOMXML_RET_OBJ(rv, new_child, &ret);
 }
 /* }}} */