Make WordPress Core


Ignore:
Timestamp:
02/02/2024 10:55:27 PM (2 years ago)
Author:
dmsnell
Message:

HTML API: Reset parser state after seeking to bookmark.

When parser states were introduced, nothing in the seek() method reset the
parser state. This is problematic because it could leave the parser in the
wrong state.

In this patch the parser state is reset so that it's properly adjusted on
the successive call to next_token().

Developed in https://github.com/WordPress/wordpress-develop/pull/6021
Discussed in https://core.trac.wordpress.org/ticket/60428

Follow-up to [57211]

Props dmsnell, kevin940726
Fixes #60428

File:
1 edited

Legend:

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

    r57506 r57527  
    23362336        // Point this tag processor before the sought tag opener and consume it.
    23372337        $this->bytes_already_parsed = $this->bookmarks[ $bookmark_name ]->start;
     2338        $this->parser_state         = self::STATE_READY;
    23382339        return $this->next_token();
    23392340    }
Note: See TracChangeset for help on using the changeset viewer.