]> git.mxchange.org Git - friendica.git/commitdiff
Fix DOMNodeList length compatibility with PHP <7.2 in Content\Text\HTML
authorHypolite Petovan <hypolite@mrpetovan.com>
Tue, 6 Aug 2019 13:00:32 +0000 (09:00 -0400)
committerHypolite Petovan <hypolite@mrpetovan.com>
Tue, 6 Aug 2019 13:00:32 +0000 (09:00 -0400)
src/Content/Text/HTML.php

index 89079fb38dca0a283bbde701f3102f03eff87b73..688895da92f2718f6aaf3f9ad72caecdb85e2316 100644 (file)
@@ -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);
                                                }