Make WordPress Core

Changeset 58112


Ignore:
Timestamp:
05/06/2024 09:23:52 PM (3 weeks ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-block-supports.php

    r56742 r58112  
    104104        }
    105105
    106         $block_attributes = array_key_exists( 'attrs', self::$block_to_render )
     106        $block_attributes = array_key_exists( 'attrs', self::$block_to_render ) && is_array( self::$block_to_render['attrs'] )
    107107            ? self::$block_to_render['attrs']
    108108            : array();
Note: See TracChangeset for help on using the changeset viewer.