From 3adbaf8ec020d653dd7e6c949a8b51073e726365 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Mon, 6 May 2024 21:23:52 +0000 Subject: [PATCH] Editor: Check that `attrs` is an array in `WP_Block_Supports::apply_block_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 --- src/wp-includes/class-wp-block-supports.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/class-wp-block-supports.php b/src/wp-includes/class-wp-block-supports.php index afc011803b0ff..c90b5e0c54c59 100644 --- a/src/wp-includes/class-wp-block-supports.php +++ b/src/wp-includes/class-wp-block-supports.php @@ -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();