@@ -974,6 +974,15 @@ private function base_class_next_token(): bool {
974974 return true ;
975975 }
976976
977+ if ( 'PLAINTEXT ' === $ tag_name ) {
978+ $ doc_length = strlen ( $ this ->html );
979+ $ this ->text_starts_at = $ this ->token_starts_at + $ this ->token_length ;
980+ $ this ->text_length = $ doc_length - $ this ->text_starts_at ;
981+ $ this ->token_length = $ doc_length - $ this ->token_starts_at ;
982+ $ this ->bytes_already_parsed = $ doc_length ;
983+ return true ;
984+ }
985+
977986 /*
978987 * There are certain elements whose children are not DATA but are instead
979988 * RCDATA or RAWTEXT. These cannot contain other elements, and the contents
@@ -2919,6 +2928,9 @@ public function get_modifiable_text(): string {
29192928
29202929 $ tag_name = $ this ->get_token_name ();
29212930 if (
2931+ // Plaintext data is not decoded.
2932+ 'PLAINTEXT ' === $ tag_name ||
2933+
29222934 // Script data is not decoded.
29232935 'SCRIPT ' === $ tag_name ||
29242936
@@ -3533,7 +3545,13 @@ private function matches(): bool {
35333545 }
35343546
35353547 // Does the tag name match the requested tag name in a case-insensitive manner?
3536- if ( isset ( $ this ->sought_tag_name ) && 0 !== substr_compare ( $ this ->html , $ this ->sought_tag_name , $ this ->tag_name_starts_at , $ this ->tag_name_length , true ) ) {
3548+ if (
3549+ isset ( $ this ->sought_tag_name ) &&
3550+ (
3551+ strlen ( $ this ->sought_tag_name ) !== $ this ->tag_name_length ||
3552+ 0 !== substr_compare ( $ this ->html , $ this ->sought_tag_name , $ this ->tag_name_starts_at , $ this ->tag_name_length , true )
3553+ )
3554+ ) {
35373555 return false ;
35383556 }
35393557
0 commit comments