Skip to content

Commit c29f5d6

Browse files
committed
Add test with null bytes in class attribute
1 parent b30cfcb commit c29f5d6

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/phpunit/tests/html-api/wpHtmlProcessor.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,4 +630,17 @@ public function test_class_list_quirks_mode() {
630630
$class_list
631631
);
632632
}
633+
634+
/**
635+
* Ensures that the tag processor matches class names with null bytes correctly.
636+
*
637+
* @ticket 61531
638+
*
639+
* @covers ::has_class
640+
*/
641+
public function test_has_class_null_byte_class_name() {
642+
$processor = WP_HTML_Processor::create_fragment( "<span class='null-byte-\0-there'></span>" );
643+
$processor->next_tag();
644+
$this->assertTrue( $processor->has_class( 'null-byte-�-there' ) );
645+
}
633646
}

0 commit comments

Comments
 (0)