From 6b7da103d74250cb20e02f49c6f3f5fd4e32c655 Mon Sep 17 00:00:00 2001 From: Evgeniy Koval Date: Tue, 16 Jul 2019 11:40:01 +0300 Subject: [PATCH] Fix for multiple rules (Issue #350) Suggested solution --- .../Transformer/Getters/MultipleElementsGetter.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Facebook/InstantArticles/Transformer/Getters/MultipleElementsGetter.php b/src/Facebook/InstantArticles/Transformer/Getters/MultipleElementsGetter.php index 8ecbba6d..eacaa108 100644 --- a/src/Facebook/InstantArticles/Transformer/Getters/MultipleElementsGetter.php +++ b/src/Facebook/InstantArticles/Transformer/Getters/MultipleElementsGetter.php @@ -31,7 +31,12 @@ public function get($node) { $fragment = $node->ownerDocument->createDocumentFragment(); foreach ($this->children as $child) { - $cloned_node = Transformer::cloneNode($child->get($node)); + $childNode = $child->get($node); + if ($childNode === null) { + continue; + } + $cloned_node = Transformer::cloneNode($childNode); + if (Type::is($cloned_node, 'DOMNode')) { $fragment->appendChild($cloned_node); }