Skip to content

Commit 0d33b2c

Browse files
westonruterclaude
andcommitted
Restore the bookmark exhaustion guard in WP_HTML_Processor::step().
The check-and-rethrow in the `catch` around `bookmark_token()` was added deliberately in r61755 so that only bookmark exhaustion is swallowed and any other exception still surfaces. It matches the guard in the second `catch` of `step()`, and PHPStan's report on it is a known false positive already ignored with an explanation in `phpstan.neon.dist`, so that ignore goes back to covering both occurrences. Co-Authored-By: Claude Opus 5.5 (medium effort) <noreply@anthropic.com> Claude-Code-Session-Id: 8c9f232d-63db-4e34-bda9-62a5e32e95a7
1 parent d03c139 commit 0d33b2c

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

‎phpstan.neon.dist‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,5 +168,5 @@ parameters:
168168
# blocks of step() can never match, when in fact they do whenever bookmarks run out.
169169
message: '#^Strict comparison using \=\=\= between ''exceeded\-max…'' and null will always evaluate to false\.$#'
170170
identifier: identical.alwaysFalse
171-
count: 1
171+
count: 2
172172
path: src/wp-includes/html-api/class-wp-html-processor.php

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1079,7 +1079,10 @@ public function step( $node_to_process = self::PROCESS_NEXT_NODE ): bool {
10791079
try {
10801080
$bookmark_name = $this->bookmark_token();
10811081
} catch ( Exception $e ) {
1082-
return false;
1082+
if ( self::ERROR_EXCEEDED_MAX_BOOKMARKS === $this->last_error ) {
1083+
return false;
1084+
}
1085+
throw $e;
10831086
}
10841087

10851088
$this->state->current_token = new WP_HTML_Token(

0 commit comments

Comments
 (0)