summaryrefslogtreecommitdiff
path: root/ext/domxml/php_domxml.c
diff options
context:
space:
mode:
authorChristian Stocker <chregu@php.net>2002-08-14 16:12:18 +0000
committerChristian Stocker <chregu@php.net>2002-08-14 16:12:18 +0000
commitc0a79401fd621d97206b21f77abd4782a86d26ed (patch)
treec5e612c9895346cb488c59519f3d329bec98886c /ext/domxml/php_domxml.c
parent9f597d2dd1c2f26a34db948edd7b51ab63c3ecbf (diff)
downloadphp-git-c0a79401fd621d97206b21f77abd4782a86d26ed.tar.gz
- 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)
Diffstat (limited to 'ext/domxml/php_domxml.c')
-rw-r--r--ext/domxml/php_domxml.c11
1 files changed, 3 insertions, 8 deletions
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);
}
/* }}} */