Skip to content

Commit

Permalink
The call to gutenberg_skip_color_serialization() from elements.php …
Browse files Browse the repository at this point in the history
…sometimes does not pass a valid $block_type, which must be an object. It is `NULL`. Perhaps due to a race condition. This commit checks if $block_type is an object before trying to use it.
  • Loading branch information
ramonjd committed Feb 23, 2022
1 parent dbd112f commit 5d99fb7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/block-supports/colors.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,10 @@ function gutenberg_apply_colors_support( $block_type, $block_attributes ) {
* @return boolean Whether to serialize color support styles & classes.
*/
function gutenberg_skip_color_serialization( $block_type, $feature = null ) {
if ( ! is_object( $block_type ) ) {
return false;
}

$path = array( 'color', '__experimentalSkipSerialization' );
$skip_serialization = _wp_array_get( $block_type->supports, $path, false );

Expand Down

0 comments on commit 5d99fb7

Please sign in to comment.