Make WordPress Core


Ignore:
Timestamp:
03/06/2023 06:53:38 PM (16 months ago)
Author:
hellofromTonya
Message:

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.

File:
1 edited

Legend:

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

    r55407 r55469  
    776776            }
    777777
    778             $at += 2;
     778            $closer_potentially_starts_at = $at;
     779            $at                          += 2;
    779780
    780781            /*
     
    819820
    820821            if ( '>' === $html[ $at ] || '/' === $html[ $at ] ) {
    821                 ++$this->bytes_already_parsed;
     822                $this->bytes_already_parsed = $closer_potentially_starts_at;
    822823                return true;
    823824            }
     
    888889
    889890            if ( '/' === $html[ $at ] ) {
    890                 $is_closing = true;
     891                $closer_potentially_starts_at = $at - 1;
     892                $is_closing                   = true;
    891893                ++$at;
    892894            } else {
     
    939941
    940942            if ( $is_closing ) {
    941                 $this->bytes_already_parsed = $at;
     943                $this->bytes_already_parsed = $closer_potentially_starts_at;
    942944                if ( $this->bytes_already_parsed >= $doc_length ) {
    943945                    return false;
     
    949951
    950952                if ( '>' === $html[ $this->bytes_already_parsed ] ) {
    951                     ++$this->bytes_already_parsed;
     953                    $this->bytes_already_parsed = $closer_potentially_starts_at;
    952954                    return true;
    953955                }
Note: See TracChangeset for help on using the changeset viewer.