From ca2055af342530f43e6ccef1be8a0cedeb397c74 Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Mon, 12 Nov 2018 10:03:48 +0000 Subject: [PATCH] Block Editor: A little cleanup to `render_block()`. Always normalize `$block['attrs']` to array in `'render_block'` filter. See #45145. Built from https://develop.svn.wordpress.org/branches/5.0@43888 git-svn-id: http://core.svn.wordpress.org/branches/5.0@43717 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/blocks.php | 7 +++++-- wp-includes/version.php | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/wp-includes/blocks.php b/wp-includes/blocks.php index b99c15b138..6e4924cd4d 100644 --- a/wp-includes/blocks.php +++ b/wp-includes/blocks.php @@ -184,10 +184,13 @@ function render_block( $block ) { $block_content .= is_string( $chunk ) ? $chunk : render_block( $block['innerBlocks'][ $index++ ] ); } + if ( ! is_array( $block['attrs'] ) ) { + $block['attrs'] = array(); + } + if ( $is_dynamic ) { - $attributes = is_array( $block['attrs'] ) ? (array) $block['attrs'] : array(); $global_post = $post; - $block_content = $block_type->render( $attributes, $block_content ); + $block_content = $block_type->render( $block['attrs'], $block_content ); $post = $global_post; } diff --git a/wp-includes/version.php b/wp-includes/version.php index ad143b78dd..6bff2d754e 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '5.0-beta3-43887'; +$wp_version = '5.0-beta3-43888'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.