From 514b46584302693146fee054134da40b5db3f27d Mon Sep 17 00:00:00 2001 From: Mark Allen Date: Mon, 14 Dec 2020 18:28:11 +0000 Subject: [PATCH] Prevent fatal when not an object --- src/PHPHtmlParser/Dom/Parser.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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('