diff --git a/Tests/OutputFilterTest.php b/Tests/OutputFilterTest.php index 0be68520..33a8529e 100644 --- a/Tests/OutputFilterTest.php +++ b/Tests/OutputFilterTest.php @@ -230,6 +230,12 @@ public function testStripImages() $this->object->stripImages('Hello <img src="wave.jpg"> I am waving at you.'), 'Should remove nested img tags' ); + + $this->assertEquals( + 'Hello I am waving at you.', + $this->object->stripImages("Hello I am waving at you."), + 'Should remove img tags containing newlines' + ); } /** @@ -260,6 +266,12 @@ public function testStripIframes() ), 'Should remove nested iFrame tags' ); + + $this->assertEquals( + 'Hello I am waving at you.', + $this->object->stripIframes("Hello I am waving at you."), + 'Should remove iFrame tags containing newlines' + ); } /** diff --git a/src/OutputFilter.php b/src/OutputFilter.php index af2d5e41..19221dad 100644 --- a/src/OutputFilter.php +++ b/src/OutputFilter.php @@ -263,8 +263,8 @@ public static function setLanguage(Language $language): void */ public static function stripImages($string) { - while (preg_match('#(<[/]?img.*>)#Ui', $string)) { - $string = preg_replace('#(<[/]?img.*>)#Ui', '', $string); + while (preg_match('#(<[/]?img.*>)#Uis', $string)) { + $string = preg_replace('#(<[/]?img.*>)#Uis', '', $string); } return $string; @@ -281,8 +281,8 @@ public static function stripImages($string) */ public static function stripIframes($string) { - while (preg_match('#(<[/]?iframe.*>)#Ui', $string)) { - $string = preg_replace('#(<[/]?iframe.*>)#Ui', '', $string); + while (preg_match('#(<[/]?iframe.*>)#Uis', $string)) { + $string = preg_replace('#(<[/]?iframe.*>)#Uis', '', $string); } return $string;