HTML API: Truncated funky comments should cause the Tag Processor to pause.

A state change was missing in the Tag Processor when the input is too short to
find a comment closer after an opened funky comment. This patch fixes a issue
where `</#` does not correctly report incomplete input, but `</# ` does.

Developed in https://github.com/wordpress/wordpress-develop/pull/7146
Discussed in https://core.trac.wordpress.org/ticket/61831

Props: jonsurrell.
Fixes #61831.

Built from https://develop.svn.wordpress.org/trunk@58858


git-svn-id: http://core.svn.wordpress.org/trunk@58254 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
dmsnell 2024-08-06 20:43:18 +00:00
parent 1396f6e30c
commit ac4ebc8d07
2 changed files with 3 additions and 1 deletions

View File

@ -1909,6 +1909,8 @@ class WP_HTML_Tag_Processor {
if ( $this->is_closing_tag ) {
// No chance of finding a closer.
if ( $at + 3 > $doc_length ) {
$this->parser_state = self::STATE_INCOMPLETE_INPUT;
return false;
}

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.7-alpha-58857';
$wp_version = '6.7-alpha-58858';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.