]> git.sesse.net Git - xml-template/commitdiff
Fix a problem with older (?) PHP5 not having a childNodes entry on
authorsgunderson@bigfoot.com <>
Sat, 26 Apr 2008 16:07:54 +0000 (18:07 +0200)
committersgunderson@bigfoot.com <>
Sat, 26 Apr 2008 16:07:54 +0000 (18:07 +0200)
DOMTextNodes.

php5/xml-template.php

index 54d1452dcc9ed2e14ce96b80d1ca66e1a4d57a60..f4581ff9c4b08e78c016773815c7869211649e3e 100644 (file)
@@ -32,7 +32,8 @@ function XML_Template_process($node, $obj, $clean = 1)
                $doc = $node->ownerDocument;
                $node->appendChild($doc->createTextNode($obj));
        } else if (is_associative_array($obj)) {              # substitute
-               for ($i = 0; $i < $node->childNodes->length; ++$i) {
+               $num_children = ($node->childNodes == null) ? 0 : $node->childNodes->length;
+               for ($i = 0; $i < $num_children; ++$i) {
                        $child = $node->childNodes->item($i);
                        $processed = false;