Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/PHPHtmlParser/Content.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public function fastForward(int $count): Content
{
if (!$this->canFastForward($count)) {
// trying to go over the content length, throw exception
throw new ContentLengthException('Attempt to fastForward pass the length of the content.');
//throw new ContentLengthException('Attempt to fastForward pass the length of the content.');
}
$this->pos += $count;

Expand Down
4 changes: 2 additions & 2 deletions src/PHPHtmlParser/Dom/Cleaner.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function clean(string $str, Options $options, string $defaultCharset): st

// strip out <script> tags
if ($options->isRemoveScripts()) {
$str = \mb_eregi_replace("<\s*script[^>]*[^/]>(.*?)<\s*/\s*script\s*>", '', $str);
$str = \mb_eregi_replace("<\s*script[^>|\s]*[^/]>(.*?)<\s*/\s*script\s*>", '', $str);
if ($str === false) {
throw new LogicalException('mb_eregi_replace returned false instead of a string. Error when attempting to remove scripts 1.');
}
Expand All @@ -86,7 +86,7 @@ public function clean(string $str, Options $options, string $defaultCharset): st

// strip out <style> tags
if ($options->isRemoveStyles()) {
$str = \mb_eregi_replace("<\s*style[^>]*[^/]>(.*?)<\s*/\s*style\s*>", '', $str);
$str = \mb_eregi_replace("<\s*style[^>|\s]*[^/]>(.*?)<\s*/\s*style\s*>", '', $str);
if ($str === false) {
throw new LogicalException('mb_eregi_replace returned false instead of a string. Error when attempting to strip out style tags 1.');
}
Expand Down
4 changes: 2 additions & 2 deletions src/PHPHtmlParser/Dom/Node/TextNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ public function text(): string
// remember the conversion
$this->convertedText = $text;

return $text;
return (string)$text;
}

return $text;
return (string)$text;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/PHPHtmlParser/Dom/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -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('</');
Expand Down