From: sgunderson@bigfoot.com <> Date: Mon, 21 Apr 2008 20:11:55 +0000 (+0200) Subject: More cloning fixes. clone.xml doesn't pass, but it passes morally. X-Git-Url: https://git.sesse.net/?p=xml-template;a=commitdiff_plain;h=b8100eaa3bfbad12dd8c758c1d28dd953b4e48fc More cloning fixes. clone.xml doesn't pass, but it passes morally. --- diff --git a/php5/xml-template.php b/php5/xml-template.php index 7ae6dcb..08c78ab 100644 --- a/php5/xml-template.php +++ b/php5/xml-template.php @@ -99,16 +99,16 @@ function XML_Template_process($node, $obj, $clean = 1) } # remove all the tags - for ($i = 0; $i < $node->childNodes->length; ++$i) { $child = $node->childNodes->item($i); if ($child->localName != 'temporary-fragment') { continue; } - for ($j = 0; $j < $child->childNodes->length; ++$j) { - $child2 = $child->childNodes->item($j); + while ($child->childNodes->length > 0) { + $child2 = $child->childNodes->item(0); $node->appendChild($child2); } + --$i; $node->removeChild($child); } }