From ad75ad5df1d88c6765af26e2a70c1898ea0f1e07 Mon Sep 17 00:00:00 2001 From: Dennis Snell Date: Wed, 18 Sep 2024 13:52:22 -0700 Subject: [PATCH] HTML API: Stop counting noop seek operations against the max seek count. Co-authored-by: Weston Ruter --- src/wp-includes/html-api/class-wp-html-tag-processor.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/wp-includes/html-api/class-wp-html-tag-processor.php b/src/wp-includes/html-api/class-wp-html-tag-processor.php index 233d47eb8da95..3e4d0ddd7aa04 100644 --- a/src/wp-includes/html-api/class-wp-html-tag-processor.php +++ b/src/wp-includes/html-api/class-wp-html-tag-processor.php @@ -2548,6 +2548,15 @@ public function seek( $bookmark_name ): bool { return false; } + $existing_bookmark = $this->bookmarks[ $bookmark_name ]; + + if ( + $this->token_starts_at === $existing_bookmark->start && + $this->token_length === $existing_bookmark->length + ) { + return true; + } + if ( ++$this->seek_count > static::MAX_SEEK_OPS ) { _doing_it_wrong( __METHOD__,