Skip to content

Commit 667b83a

Browse files
authored
Update Cleaner.php
1 parent 36dca65 commit 667b83a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/PHPHtmlParser/Dom/Cleaner.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010

1111
class Cleaner implements CleanerInterface
1212
{
13+
mb_regex_encoding('UTF-8');
14+
mb_regex_set_options('m');
15+
1316
/**
1417
* Cleans the html of any none-html information.
1518
*
@@ -74,7 +77,7 @@ public function clean(string $str, Options $options, string $defaultCharset): st
7477

7578
// strip out <script> tags
7679
if ($options->isRemoveScripts()) {
77-
$str = \mb_eregi_replace("<\s*script[^>]*[^/]>(.*?)<\s*/\s*script\s*>", '', $str);
80+
$str = preg_replace("/<\s*script[^>]*[^\/]>(.*?)<\s*\/\s*script\s*>/is", '', $str);
7881
if ($str === false) {
7982
throw new LogicalException('mb_eregi_replace returned false instead of a string. Error when attempting to remove scripts 1.');
8083
}

0 commit comments

Comments
 (0)