diff --git a/src/Readability.php b/src/Readability.php index 290cc28..79e42ff 100644 --- a/src/Readability.php +++ b/src/Readability.php @@ -1480,6 +1480,7 @@ private function hasSingleTagInsideElement(\DOMElement $node, string $tag): bool $childNodes = iterator_to_array($node->childNodes); $children = array_filter($childNodes, fn ($childNode) => $childNode instanceof \DOMElement); + $children = array_values($children); // There should be exactly 1 element child with given tag if (1 !== \count($children) || $children[0]->nodeName !== $tag) { return false;