Commit 787534a65f for wordpress.org
commit 787534a65f2978c7ad13ca4bc79b6fef1fbee5a4
Author: dmsnell <dmsnell@git.wordpress.org>
Date: Fri Oct 30 17:22:56 2026 +0000
Blocks: Ensure array type when implicitly closing nested blocks.
When a fix was recently applied to the block parser for implicitly closing open blocks that remain open at the end of a document, the fix appended the structured `WP_Block_Parser_Block` class instance to the list of output blocks. This led to issues with code assuming array data types, accessing properties with array access rather than object access.
This patch casts the object to an array to ensure compatibility.
Developed in: https://github.com/WordPress/wordpress-develop/pull/15199
Discussed in: https://core.trac.wordpress.org/ticket/66138
Follow-up to r64996.
Props chihsuan.
See #66138.
Built from https://develop.svn.wordpress.org/trunk@65062
git-svn-id: http://core.svn.wordpress.org/trunk@64212 1a063a9b-81f0-0310-95a4-ce76da25c4cd
diff --git a/wp-includes/class-wp-block-parser.php b/wp-includes/class-wp-block-parser.php
index 1689dafcd2..07ddf52fc5 100644
--- a/wp-includes/class-wp-block-parser.php
+++ b/wp-includes/class-wp-block-parser.php
@@ -415,7 +415,7 @@ class WP_Block_Parser {
if ( isset( $implicitly_closed ) ) {
$stack_top->block->innerContent[] = null;
- $stack_top->block->innerBlocks[] = $implicitly_closed;
+ $stack_top->block->innerBlocks[] = (array) $implicitly_closed;
}
$implicitly_closed = $stack_top->block;
diff --git a/wp-includes/version.php b/wp-includes/version.php
index e38e1f929d..09750cc56f 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '7.2-beta3-65061';
+$wp_version = '7.2-beta3-65062';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.