diff --git a/Tests/OutputFilterTest.php b/Tests/OutputFilterTest.php
index e702139d..4f6693f4 100644
--- a/Tests/OutputFilterTest.php
+++ b/Tests/OutputFilterTest.php
@@ -215,6 +215,18 @@ public function testStripImages()
$this->object->stripImages('Hello I am waving at you.'),
'Should remove img tags'
);
+
+ $this->assertEquals(
+ 'Hello I am waving at you.',
+ $this->object->stripImages('Hello I am waving at you.'),
+ 'Should remove uppercase img tags'
+ );
+
+ $this->assertEquals(
+ 'Hello I am waving at you.',
+ $this->object->stripImages('Hello <IMg src="wave.jpg"> I am waving at you.'),
+ 'Should remove nested tags'
+ );
}
/**
@@ -229,5 +241,19 @@ public function testStripIframes()
),
'Should remove iFrame tags'
);
+
+ $this->assertEquals(
+ 'Hello I am waving at you.',
+ $this->object->stripIframes('Hello I am waving at you.'),
+ 'Should remove uppercase iFrame tags'
+ );
+
+ $this->assertEquals(
+ 'Hello I am waving at you.',
+ $this->object->stripIframes('Hello < I am waving at you.'),
+ 'Should remove nested iFrame tags'
+ );
}
}
diff --git a/src/OutputFilter.php b/src/OutputFilter.php
index d78e8032..996393d0 100644
--- a/src/OutputFilter.php
+++ b/src/OutputFilter.php
@@ -275,7 +275,12 @@ public static function setLanguage(Language $language): void
*/
public static function stripImages($string)
{
- return preg_replace('#(<[/]?img.*>)#U', '', $string);
+ while (preg_match('#(<[/]?img.*>)#Ui', $string))
+ {
+ $string = preg_replace('#(<[/]?img.*>)#Ui', '', $string);
+ }
+
+ return $string;
}
/**
@@ -289,6 +294,11 @@ public static function stripImages($string)
*/
public static function stripIframes($string)
{
- return preg_replace('#(<[/]?iframe.*>)#U', '', $string);
+ while (preg_match('#(<[/]?iframe.*>)#Ui', $string))
+ {
+ $string = preg_replace('#(<[/]?iframe.*>)#Ui', '', $string);
+ }
+
+ return $string;
}
}