From 79374dbf7a57ffd31819ab230da506117233520a Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Tue, 6 Aug 2019 09:00:32 -0400 Subject: [PATCH] Fix DOMNodeList length compatibility with PHP <7.2 in Content\Text\HTML --- src/Content/Text/HTML.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Content/Text/HTML.php b/src/Content/Text/HTML.php index 89079fb38d..688895da92 100644 --- a/src/Content/Text/HTML.php +++ b/src/Content/Text/HTML.php @@ -102,7 +102,7 @@ class HTML /** @var \DOMNode $child */ foreach ($node->childNodes as $key => $child) { /* Remove empty text nodes at the start or at the end of the children list */ - if ($key > 0 && $key < count($node->childNodes) -1 || trim($child->nodeValue)) { + if ($key > 0 && $key < $node->childNodes->length - 1 || trim($child->nodeValue)) { $newNode = $child->cloneNode(true); $node->parentNode->insertBefore($newNode, $node); }