Bug #15966: replace_node incorrect

From: Date: Sat, 09 Mar 2002 01:39:23 +0000
Subject: Bug #15966: replace_node incorrect
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-2075@lists.php.net to get a copy of this message
From: bigredlinux@yahoo.com Operating system: Linux PHP version: 4.1.2 PHP Bug Type: DOM XML related Bug description: replace_node incorrect When replace_node is used, if the new node being inserted already exists in the xml document, it is to be first removed. Thus, the following lines in the C code are incorrect... if (NULL == (new_repnode = xmlCopyNode(repnode, 1))) { php_error(E_WARNING, "%s(): unable to clone node", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } repnode = xmlReplaceNode(nodep, new_repnode); This code is making a copy of the new node, and hence when the libxml2 function xmlReplaceNode is run, it does not remove the node already existing in the document. The call to xmlReplaceNode should be the repnode, not the new_repnode. As a matter of fact, I see no need to even attempt to clone the node, unless it is to check that it is a true node. Thoughts? -- Edit bug report at http://bugs.php.net/?id=15966&edit=1 -- Fixed in CVS: http://bugs.php.net/fix.php?id=15966&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=15966&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=15966&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=15966&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=15966&r=support Expected behavior: http://bugs.php.net/fix.php?id=15966&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=15966&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=15966&r=submittedtwice

« previous php.bugs (#2075) next »