Skip to content

Commit e7d649c

Browse files
committed
Handle insert_virtual_node exceptions
1 parent 4101235 commit e7d649c

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,6 +1160,14 @@ public function step( $node_to_process = self::PROCESS_NEXT_NODE ): bool {
11601160
* otherwise might involve messier calling and return conventions.
11611161
*/
11621162
return false;
1163+
} catch ( Exception $e ) {
1164+
if ( self::ERROR_EXCEEDED_MAX_BOOKMARKS === $this->last_error ) {
1165+
return false;
1166+
}
1167+
/*
1168+
* Rethrow any other exceptions for higher-level handling.
1169+
*/
1170+
throw $e;
11631171
}
11641172
}
11651173

@@ -6296,6 +6304,8 @@ private function insert_foreign_element( WP_HTML_Token $token, bool $only_add_to
62966304
*
62976305
* @since 6.7.0
62986306
*
6307+
* @throws Exception When unable to allocate a bookmark for the next token in the input HTML document.
6308+
*
62996309
* @param string $token_name Name of token to create and insert into the stack of open elements.
63006310
* @param string|null $bookmark_name Optional. Name to give bookmark for created virtual node.
63016311
* Defaults to auto-creating a bookmark name.

0 commit comments

Comments
 (0)