Skip to content

Commit

Permalink
Editor: Check that attrs is an array in `WP_Block_Supports::apply_b…
Browse files Browse the repository at this point in the history
…lock_supports()`.

This prevents a fatal error in `wp_apply_custom_classname_support()`, which expects an array data type for block attributes, and makes sure the block editor can still load if there is a mistake in the attributes of a block.

Follow-up to [54498].

Props caercam.
Fixes #61151.

git-svn-id: https://develop.svn.wordpress.org/trunk@58112 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
SergeyBiryukov committed May 6, 2024
1 parent 982e9b7 commit 3adbaf8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/wp-includes/class-wp-block-supports.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public function apply_block_supports() {
return array();
}

$block_attributes = array_key_exists( 'attrs', self::$block_to_render )
$block_attributes = array_key_exists( 'attrs', self::$block_to_render ) && is_array( self::$block_to_render['attrs'] )
? self::$block_to_render['attrs']
: array();

Expand Down

0 comments on commit 3adbaf8

Please sign in to comment.