Changeset 58969
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/html-api/class-wp-html-tag-processor.php
r58925 r58969 1161 1161 * @see https://www.w3.org/TR/CSS2/syndata.html#x1 1162 1162 */ 1163 $name = str tolower( substr( $class, $at, $length) );1163 $name = str_replace( "\x00", "\u{FFFD}", strtolower( substr( $class, $at, $length ) ) ); 1164 1164 $at += $length; 1165 1165 -
trunk/tests/phpunit/tests/html-api/wpHtmlTagProcessor.php
r58925 r58969 2235 2235 2236 2236 $this->assertSame( array( 'one' ), $found_classes, 'Visited multiple copies of the same class name when it should have skipped the duplicates.' ); 2237 } 2238 2239 /** 2240 * Ensures that null bytes are replaced with the replacement character (U+FFFD) in class_list. 2241 * 2242 * @ticket 61531 2243 * 2244 * @covers WP_HTML_Tag_Processor::class_list 2245 */ 2246 public function test_class_list_null_bytes_replaced() { 2247 $processor = new WP_HTML_Tag_Processor( "<div class='a \0 b\0 \0c\0'>" ); 2248 $processor->next_tag(); 2249 2250 $found_classes = iterator_to_array( $processor->class_list() ); 2251 2252 $this->assertSame( array( 'a', "\u{FFFD}", "b\u{FFFD}", "\u{FFFD}c\u{FFFD}" ), $found_classes ); 2253 } 2254 2255 /** 2256 * Ensures that the tag processor matches class names with null bytes correctly. 2257 * 2258 * @ticket 61531 2259 * 2260 * @covers WP_HTML_Tag_Processor::has_class 2261 */ 2262 public function test_has_class_null_byte_class_name() { 2263 $processor = new WP_HTML_Tag_Processor( "<div class='null-byte-\0-there'>" ); 2264 $processor->next_tag(); 2265 $this->assertTrue( $processor->has_class( 'null-byte-�-there' ) ); 2237 2266 } 2238 2267
Note: See TracChangeset
for help on using the changeset viewer.