From 9519a084f18ddb2e772ca4be27c0bf834f364f55 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Wed, 9 Jun 2010 16:03:58 +0200 Subject: [PATCH] fixed toXml() method when some nodes are null --- lib/Twig/Node.php | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/lib/Twig/Node.php b/lib/Twig/Node.php index 9fc162d..488918d 100644 --- a/lib/Twig/Node.php +++ b/lib/Twig/Node.php @@ -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); -- 1.7.2.5