Fix DOMNodeList length compatibility with PHP <7.2 in Content\Text\HTML
This commit is contained in:
parent
d1db9bc8e6
commit
79374dbf7a
|
@ -102,7 +102,7 @@ class HTML
|
||||||
/** @var \DOMNode $child */
|
/** @var \DOMNode $child */
|
||||||
foreach ($node->childNodes as $key => $child) {
|
foreach ($node->childNodes as $key => $child) {
|
||||||
/* Remove empty text nodes at the start or at the end of the children list */
|
/* 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);
|
$newNode = $child->cloneNode(true);
|
||||||
$node->parentNode->insertBefore($newNode, $node);
|
$node->parentNode->insertBefore($newNode, $node);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user