From c0a79401fd621d97206b21f77abd4782a86d26ed Mon Sep 17 00:00:00 2001 From: Christian Stocker Date: Wed, 14 Aug 2002 16:12:18 +0000 Subject: - fix for bug #17771 (insert_before misbeaviour (DOM L2 spec.)) @ - DomNode->insert_before behaves now according to W3C spec @ ie. new_child is moved, not copied. (chregu) --- ext/domxml/php_domxml.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'ext/domxml/php_domxml.c') diff --git a/ext/domxml/php_domxml.c b/ext/domxml/php_domxml.c index f8c4c7508a..b95306753e 100644 --- a/ext/domxml/php_domxml.c +++ b/ext/domxml/php_domxml.c @@ -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); } /* }}} */ -- cgit v1.2.1