Skip to content

Commit f9e002c

Browse files
phpcbf
1 parent fbeed82 commit f9e002c

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

src/wp-includes/kses.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -274,10 +274,10 @@
274274
),
275275
'small' => array(),
276276
'source' => array(
277-
'srcset' => true,
278-
'type' => true,
279-
'media' => true,
280-
'sizes' => true,
277+
'srcset' => true,
278+
'type' => true,
279+
'media' => true,
280+
'sizes' => true,
281281
),
282282
'strike' => array(),
283283
'strong' => array(),

tests/phpunit/tests/kses.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2499,7 +2499,7 @@ public function test_wp_filter_post_kses_picture() {
24992499
*/
25002500
public function test_wp_kses_sanitize_uris( $attrname, $attrvalue, $expected, $multi_uri = array( 'srcset' ) ) {
25012501
$allowed_protocols = wp_allowed_protocols();
2502-
$result = wp_kses_sanitize_uris( $attrname, $attrvalue, $allowed_protocols, $multi_uri );
2502+
$result = wp_kses_sanitize_uris( $attrname, $attrvalue, $allowed_protocols, $multi_uri );
25032503
$this->assertEquals( $expected, $result );
25042504
}
25052505

@@ -2533,7 +2533,7 @@ public function data_wp_kses_sanitize_uris() {
25332533
*/
25342534
public function test_wp_kses_srcset_edge_cases( $srcset_value, $expected ) {
25352535
$allowed_protocols = wp_allowed_protocols();
2536-
$result = wp_kses_sanitize_uris( 'srcset', $srcset_value, $allowed_protocols );
2536+
$result = wp_kses_sanitize_uris( 'srcset', $srcset_value, $allowed_protocols );
25372537
$this->assertEquals( $expected, $result );
25382538
}
25392539

@@ -2563,13 +2563,13 @@ public function test_wp_kses_malicious_input() {
25632563

25642564
// JavaScript in srcset - the entire img tag gets escaped when it contains dangerous content.
25652565
$original = '<img srcset="javascript:alert(1) 1x, data:text/html,<script>alert(1)</script> 2x" />';
2566-
$result = wp_kses( $original, $allowedposttags );
2566+
$result = wp_kses( $original, $allowedposttags );
25672567
// The whole img tag should be escaped when it contains script content.
25682568
$this->assertStringStartsWith( '&lt;', $result );
25692569

25702570
// Script tag in picture element (should be stripped).
25712571
$original = '<picture><script>alert(1)</script><source srcset="image.jpg"><img src="fallback.jpg"></picture>';
2572-
$result = wp_kses( $original, $allowedposttags );
2572+
$result = wp_kses( $original, $allowedposttags );
25732573
// Script content should be converted to text, not completely removed.
25742574
$this->assertStringContainsString( 'alert(1)', $result );
25752575
$this->assertStringNotContainsString( '<script>', $result );
@@ -2615,7 +2615,7 @@ public function test_wp_kses_comprehensive_responsive_images() {
26152615

26162616
// Test picture with multiple sources and mixed protocols.
26172617
$original = '<picture><source srcset="javascript:void(0) 480w, https://example.com/mobile.webp 480w" type="image/webp" media="(max-width: 600px)"><source srcset="bad://example.com/tablet.jpg 768w, https://example.com/tablet.jpg 768w" type="image/jpeg" media="(max-width: 1200px)"><img src="https://example.com/desktop.jpg" alt="Picture element test" /></picture>';
2618-
$result = wp_kses( $original, $allowedposttags );
2618+
$result = wp_kses( $original, $allowedposttags );
26192619

26202620
// Should remove bad protocols but keep valid ones.
26212621
$this->assertStringContainsString( 'https://example.com/mobile.webp', $result );
@@ -2625,7 +2625,7 @@ public function test_wp_kses_comprehensive_responsive_images() {
26252625

26262626
// Test nested picture scenario.
26272627
$original = '<picture><picture><source srcset="inner.jpg"></picture><source srcset="outer.jpg"><img src="fallback.jpg"></picture>';
2628-
$result = wp_kses( $original, $allowedposttags );
2628+
$result = wp_kses( $original, $allowedposttags );
26292629
// KSES allows the nesting but should preserve the structure.
26302630
$this->assertStringContainsString( '<picture>', $result );
26312631
$this->assertStringContainsString( '<source', $result );

0 commit comments

Comments
 (0)