diff --git a/src/PHPHtmlParser/Dom/Parser.php b/src/PHPHtmlParser/Dom/Parser.php index 7ed310cb..f9c5a32c 100644 --- a/src/PHPHtmlParser/Dom/Parser.php +++ b/src/PHPHtmlParser/Dom/Parser.php @@ -37,7 +37,7 @@ public function parse(Options $options, Content $content, int $size): AbstractNo $root->setHtmlSpecialCharsDecode($options->isHtmlSpecialCharsDecode()); $activeNode = $root; while ($activeNode !== null) { - if ($activeNode && $activeNode->tag->name() === 'script' + if ($activeNode && is_object( $activeNode->tag ) && $activeNode->tag->name() === 'script' && $options->isCleanupInput() !== true ) { $str = $content->copyUntil('