Changeset 59464
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/html-api/class-wp-html-tag-processor.php
r59250 r59464 1669 1669 * @see https://html.spec.whatwg.org/#tag-open-state 1670 1670 */ 1671 if ( 1 !== strspn( $html, '!/?abcdefghijklmnopqrstuvwxyzABC EFGHIJKLMNOPQRSTUVWXYZ', $at + 1, 1 ) ) {1671 if ( 1 !== strspn( $html, '!/?abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', $at + 1, 1 ) ) { 1672 1672 ++$at; 1673 1673 continue; -
trunk/tests/phpunit/tests/html-api/wpHtmlTagProcessor.php
r58969 r59464 2985 2985 $this->assertNull( $doctype->system_identifier ); 2986 2986 } 2987 2988 /** 2989 * @ticket 62522 2990 * 2991 * @dataProvider data_alphabet_by_characters_lowercase 2992 */ 2993 public function test_recognizes_lowercase_tag_name( string $char ) { 2994 /* 2995 * The spacing in the HTML string is important to the problematic 2996 * codepath in ticket #62522. 2997 */ 2998 $html = " <{$char}> </{$char}>"; 2999 $processor = new WP_HTML_Tag_Processor( $html ); 3000 $this->assertTrue( $processor->next_tag(), "Failed to find open tag in '{$html}'." ); 3001 $this->assertTrue( 3002 $processor->next_tag( array( 'tag_closers' => 'visit' ) ), 3003 "Failed to find close tag in '{$html}'." 3004 ); 3005 } 3006 3007 /** 3008 * @ticket 62522 3009 * 3010 * @dataProvider data_alphabet_by_characters_uppercase 3011 */ 3012 public function test_recognizes_uppercase_tag_name( string $char ) { 3013 /* 3014 * The spacing in the HTML string is important to the problematic 3015 * codepath in ticket #62522. 3016 */ 3017 $html = " <{$char}> </{$char}>"; 3018 $processor = new WP_HTML_Tag_Processor( $html ); 3019 $this->assertTrue( $processor->next_tag(), "Failed to find open tag in '{$html}'." ); 3020 $this->assertTrue( 3021 $processor->next_tag( array( 'tag_closers' => 'visit' ) ), 3022 "Failed to find close tag in '{$html}'." 3023 ); 3024 } 3025 3026 /** 3027 * Data provider. 3028 * 3029 * @return Generator<array> 3030 */ 3031 public static function data_alphabet_by_characters_lowercase() { 3032 $char = 'a'; 3033 while ( $char <= 'z' ) { 3034 yield $char => array( $char ); 3035 $char = chr( ord( $char ) + 1 ); 3036 } 3037 } 3038 3039 /** 3040 * Data provider. 3041 * 3042 * @return Generator<array> 3043 */ 3044 public static function data_alphabet_by_characters_uppercase() { 3045 foreach ( self::data_alphabet_by_characters_lowercase() as $data ) { 3046 yield strtoupper( $data[0] ) => array( strtoupper( $data[0] ) ); 3047 } 3048 } 2987 3049 }
Note: See TracChangeset
for help on using the changeset viewer.