Skip to content

Commit 3d77195

Browse files
committed
HTML API: Reset parser state after seeking to bookmark.
When parser states were introduced in WordPress#5683, 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 get's properly adjusted on the successive call to `next_token()`. Follows [57348] Props @kevin940726 for finding and reporting.
1 parent 235cb39 commit 3d77195

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2335,6 +2335,7 @@ public function seek( $bookmark_name ) {
23352335

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
}
23402341

0 commit comments

Comments
 (0)