Commit 84bf703227 for wordpress.org
commit 84bf7032271dc2188e5be17370a73a7900f56501
Author: dmsnell <dmsnell@git.wordpress.org>
Date: Thu Jan 22 01:12:36 2026 +0000
Blocks: Ensure extract_full_block_and_advance() matches parse_blocks()
The behavior of WP_Block_Processor::extract_full_block_and_advance() should produce an identical output to what parse_blocks() would return on the same substring of input.
Unfortunately, when HTML spans followed inner blocks, they were being omitted in the output parse tree. This was due to an omission in the original code which would look for those blocks before advancing again after calling `extract_full_block_and_advance()` recursively.
This patch adds the missing check and resolves the discrepancy.
Developed in: https://github.com/WordPress/wordpress-develop/pull/10769
Discussed in: https://core.trac.wordpress.org/ticket/64538
Follow-up to [60939].
Props dmsnell, jonsurrell, jorbin.
Fixes #64537.
Built from https://develop.svn.wordpress.org/trunk@61509
git-svn-id: http://core.svn.wordpress.org/trunk@60820 1a063a9b-81f0-0310-95a4-ce76da25c4cd
diff --git a/wp-includes/class-wp-block-processor.php b/wp-includes/class-wp-block-processor.php
index 39f79b99e7..7b20fbf85d 100644
--- a/wp-includes/class-wp-block-processor.php
+++ b/wp-includes/class-wp-block-processor.php
@@ -1295,6 +1295,17 @@ class WP_Block_Processor {
$block['innerBlocks'][] = $inner_block;
$block['innerContent'][] = null;
}
+
+ /*
+ * Because the parser has advanced past the closing block token, it
+ * may be matched on an HTML span. This needs to be processed before
+ * moving on to the next token at the start of the next loop iteration.
+ */
+ if ( $this->is_html() ) {
+ $chunk = $this->get_html_content();
+ $block['innerHTML'] .= $chunk;
+ $block['innerContent'][] = $chunk;
+ }
}
return $block;
diff --git a/wp-includes/version.php b/wp-includes/version.php
index dad5dd2184..3c4609afef 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '7.0-alpha-61508';
+$wp_version = '7.0-alpha-61509';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.