Skip to content

Commit 5f09f49

Browse files
committed
HTML API: Fix CDATA lookalike matching invalid CDATA
When `next_token()` was introduced to the HTML Tag Processor, it started classifying comments that look like they were intended to be CDATA sections. In one of the changes made during development, however, a typo slipped through code review that treated comments as CDATA even if they only ended in `]>` and not the required `]]>`. The consequences of this defect were minor because in all cases these are treated as HTML comments from invalid syntax, but this patch adds the missing check to ensure the proper reporting of CDATA-lookalikes. Follow-up to [57348] Props jonsurrell Fixes #60406 Built from https://develop.svn.wordpress.org/trunk@57506 git-svn-id: https://core.svn.wordpress.org/trunk@57007 1a063a9b-81f0-0310-95a4-ce76da25c4cd
1 parent 67f44bc commit 5f09f49

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

wp-includes/html-api/class-wp-html-tag-processor.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1762,7 +1762,8 @@ private function parse_next_tag() {
17621762
'T' === $html[ $this->token_starts_at + 6 ] &&
17631763
'A' === $html[ $this->token_starts_at + 7 ] &&
17641764
'[' === $html[ $this->token_starts_at + 8 ] &&
1765-
']' === $html[ $closer_at - 1 ]
1765+
']' === $html[ $closer_at - 1 ] &&
1766+
']' === $html[ $closer_at - 2 ]
17661767
) {
17671768
$this->parser_state = self::STATE_COMMENT;
17681769
$this->comment_type = self::COMMENT_AS_CDATA_LOOKALIKE;

wp-includes/version.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*
1717
* @global string $wp_version
1818
*/
19-
$wp_version = '6.5-alpha-57505';
19+
$wp_version = '6.5-alpha-57506';
2020

2121
/**
2222
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.

0 commit comments

Comments
 (0)