HTML API: Fix finding RCData and Script tag closers.

Fixes finding the following tag closers `</script>`, `</textarea>`, and `</title>` in `WP_HTML_Tag_Processor`.

Follow-up to [55407], [55203].

Props zieladam, dmsnell, hellofromTonya.
Fixes #57852.
See #57575.
Built from https://develop.svn.wordpress.org/trunk@55469


git-svn-id: http://core.svn.wordpress.org/trunk@55002 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
hellofromTonya 2023-03-06 18:55:21 +00:00
parent c2cd23a06b
commit 39308664bf
2 changed files with 8 additions and 6 deletions

View File

@ -775,7 +775,8 @@ class WP_HTML_Tag_Processor {
return false;
}
$at += 2;
$closer_potentially_starts_at = $at;
$at += 2;
/*
* Find a case-insensitive match to the tag name.
@ -818,7 +819,7 @@ class WP_HTML_Tag_Processor {
}
if ( '>' === $html[ $at ] || '/' === $html[ $at ] ) {
++$this->bytes_already_parsed;
$this->bytes_already_parsed = $closer_potentially_starts_at;
return true;
}
}
@ -887,7 +888,8 @@ class WP_HTML_Tag_Processor {
}
if ( '/' === $html[ $at ] ) {
$is_closing = true;
$closer_potentially_starts_at = $at - 1;
$is_closing = true;
++$at;
} else {
$is_closing = false;
@ -938,7 +940,7 @@ class WP_HTML_Tag_Processor {
}
if ( $is_closing ) {
$this->bytes_already_parsed = $at;
$this->bytes_already_parsed = $closer_potentially_starts_at;
if ( $this->bytes_already_parsed >= $doc_length ) {
return false;
}
@ -948,7 +950,7 @@ class WP_HTML_Tag_Processor {
}
if ( '>' === $html[ $this->bytes_already_parsed ] ) {
++$this->bytes_already_parsed;
$this->bytes_already_parsed = $closer_potentially_starts_at;
return true;
}
}

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.2-beta4-55468';
$wp_version = '6.2-beta4-55469';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.