Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions src/wp-includes/class-wp-block.php
Original file line number Diff line number Diff line change
Expand Up @@ -491,22 +491,25 @@ public function replace_rich_text( $rich_text ) {
return false;
}

$depth = $this->get_current_depth();
$depth = $this->get_current_depth();
$tag_name = $this->get_tag();

$this->set_bookmark( '_wp_block_bindings_tag_opener' );
$this->set_bookmark( '_wp_block_bindings' );
// The bookmark names are prefixed with `_` so the key below has an extra `_`.
$tag_opener = $this->bookmarks['__wp_block_bindings_tag_opener'];
$tag_opener = $this->bookmarks['__wp_block_bindings'];
$start = $tag_opener->start + $tag_opener->length;
$this->release_bookmark( '_wp_block_bindings_tag_opener' );

// Find matching tag closer.
while ( $this->next_token() && $this->get_current_depth() >= $depth ) {
}

$this->set_bookmark( '_wp_block_bindings_tag_closer' );
$tag_closer = $this->bookmarks['__wp_block_bindings_tag_closer'];
if ( ! $this->is_tag_closer() || $tag_name !== $this->get_tag() ) {
return false;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the check I had in mind was more like this…

if ( $this->paused_at_incomplete_token() || null !== $this->get_last_error() ) {
	return false;
}

these affirmative checks should also work though, and may be better since they measure directly the condition we want rather than checking the conditions we don’t want.


$this->set_bookmark( '_wp_block_bindings' );
$tag_closer = $this->bookmarks['__wp_block_bindings'];
$end = $tag_closer->start;
$this->release_bookmark( '_wp_block_bindings_tag_closer' );

$this->lexical_updates[] = new WP_HTML_Text_Replacement(
$start,
Expand Down
Loading