fixed toXml() method when some nodes are null

This commit is contained in:
Fabien Potencier
2010-06-09 16:03:58 +02:00
parent 8809a1cab1
commit 9519a084f1
+4
View File
@@ -79,6 +79,10 @@ class Twig_Node implements Twig_NodeInterface, ArrayAccess, Countable, Iterator
}
foreach ($this->nodes as $name => $n) {
if (null === $n) {
continue;
}
$child = $n->toXml(true)->getElementsByTagName('node')->item(0);
$child = $dom->importNode($child, true);
$child->setAttribute('name', $name);