Make WordPress Core


Ignore:
Timestamp:
02/01/2024 12:10:19 AM (2 years ago)
Author:
dmsnell
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/html-api/class-wp-html-tag-processor.php

    r57489 r57506  
    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;
Note: See TracChangeset for help on using the changeset viewer.