@@ -64,11 +64,8 @@ public static function provideSanitizeHead()
6464 }
6565
6666 #[DataProvider('provideSanitizeBody ' )]
67- public function testSanitizeBody (string $ input , string $ expected, ? string $ legacyExpected = null )
67+ public function testSanitizeBody (string $ input , string $ expected )
6868 {
69- if (\PHP_VERSION_ID < 80400 ) {
70- $ expected = $ legacyExpected ?? $ expected ;
71- }
7269 $ this ->assertSame ($ expected , $ this ->createSanitizer ()->sanitize ($ input ));
7370 }
7471
@@ -87,7 +84,6 @@ public static function provideSanitizeBody()
8784 [
8885 '< Hello ' ,
8986 '< Hello ' ,
90- ' Hello ' ,
9187 ],
9288 [
9389 'Lorem & Ipsum ' ,
@@ -132,7 +128,6 @@ public static function provideSanitizeBody()
132128 [
133129 '<<a href="javascript:evil"/>a href="javascript:evil"/> ' ,
134130 '<<a>a href="javascript:evil"/></a> ' ,
135- '<a>a href="javascript:evil"/></a> ' ,
136131 ],
137132 [
138133 '<a href="javascript:alert( \'ok \')">Test</a> ' ,
@@ -169,12 +164,10 @@ public static function provideSanitizeBody()
169164 [
170165 '<<img src="javascript:evil"/>iframe src="javascript:evil"/> ' ,
171166 '<<img />iframe src="javascript:evil"/> ' ,
172- '<img />iframe src="javascript:evil"/> ' ,
173167 ],
174168 [
175169 '<<img src="javascript:evil"/>img src="javascript:evil"/> ' ,
176170 '<<img />img src="javascript:evil"/> ' ,
177- '<img />img src="javascript:evil"/> ' ,
178171 ],
179172 [
180173 '<IMG SRC="javascript:alert( \'XSS \');"> ' ,
@@ -219,12 +212,10 @@ public static function provideSanitizeBody()
219212 [
220213 '<IMG SRC=javascript:alert('XSS')> ' ,
221214 '<img /> ' ,
222- '<img src="&#0000106&#0000097&#0000118&#0000097&#0000115&#0000099&#0000114&#0000105&#0000112&#0000116&#0000058&#0000097&#0000108&#0000101&#0000114&#0000116&#0000040&#0000039&#0000088&#0000083&#0000083&#0000039&#0000041" /> ' ,
223215 ],
224216 [
225217 '<IMG SRC=javascript:alert('XSS')> ' ,
226218 '<img /> ' ,
227- '<img src="&#x6A&#x61&#x76&#x61&#x73&#x63&#x72&#x69&#x70&#x74&#x3A&#x61&#x6C&#x65&#x72&#x74&#x28&#x27&#x58&#x53&#x53&#x27&#x29" /> ' ,
228219 ],
229220 [
230221 '<IMG DYNSRC="javascript:alert( \'XSS \')"> ' ,
@@ -531,7 +522,6 @@ public static function provideSanitizeBody()
531522 [
532523 '<table>Lorem ipsum</table> ' ,
533524 'Lorem ipsum<table></table> ' ,
534- '<table>Lorem ipsum</table> ' ,
535525 ],
536526 [
537527 '<ul>Lorem ipsum</ul> ' ,
@@ -545,12 +535,8 @@ public static function provideSanitizeBody()
545535 }
546536
547537 #[DataProvider('provideSanitizeTable ' )]
548- public function testSanitizeTable (string $ input , string $ expected, ? string $ legacyExpected = null )
538+ public function testSanitizeTable (string $ input , string $ expected )
549539 {
550- if (\PHP_VERSION_ID < 80400 ) {
551- $ expected = $ legacyExpected ?? $ expected ;
552- }
553-
554540 $ this ->assertSame ($ expected , $ this ->createSanitizer ()->sanitizeFor ('table ' , $ input ));
555541 }
556542
@@ -564,32 +550,26 @@ public static function provideSanitizeTable(): iterable
564550 [
565551 '<tbody>Lorem ipsum</tbody> ' ,
566552 '<tbody></tbody> ' ,
567- '<tbody>Lorem ipsum</tbody> ' ,
568553 ],
569554 [
570555 '<td>Lorem ipsum</td> ' ,
571556 '<tbody><tr><td>Lorem ipsum</td></tr></tbody> ' ,
572- '<td>Lorem ipsum</td> ' ,
573557 ],
574558 [
575559 '<tfoot>Lorem ipsum</tfoot> ' ,
576560 '<tfoot></tfoot> ' ,
577- '<tfoot>Lorem ipsum</tfoot> ' ,
578561 ],
579562 [
580563 '<thead>Lorem ipsum</thead> ' ,
581564 '<thead></thead> ' ,
582- '<thead>Lorem ipsum</thead> ' ,
583565 ],
584566 [
585567 '<th>Lorem ipsum</th> ' ,
586568 '<tbody><tr><th>Lorem ipsum</th></tr></tbody> ' ,
587- '<th>Lorem ipsum</th> ' ,
588569 ],
589570 [
590571 '<tr>Lorem ipsum</tr> ' ,
591572 '<tbody><tr></tr></tbody> ' ,
592- '<tr>Lorem ipsum</tr> ' ,
593573 ],
594574 ];
595575 }
0 commit comments