From ffad402ba3e051aa44593de5a70a8a0079a8908c Mon Sep 17 00:00:00 2001 From: spacedmonkey Date: Mon, 25 Sep 2023 12:17:23 +0000 Subject: [PATCH] Themes: Use instanceof in block_has_support. In [50761], the block_has_support function was introduced. However, using `property_exists` within this function negatively impacted its performance. This commit replaces the `property_exists` function call with `instanceof WP_Block_Type`, resulting in improved performance. Props mukesh27, gziolo, spacedmonkey. Fixes #59441. Built from https://develop.svn.wordpress.org/trunk@56678 git-svn-id: http://core.svn.wordpress.org/trunk@56190 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/blocks.php | 2 +- wp-includes/version.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-includes/blocks.php b/wp-includes/blocks.php index 31baf119ff..323719efc4 100644 --- a/wp-includes/blocks.php +++ b/wp-includes/blocks.php @@ -1589,7 +1589,7 @@ function unregister_block_style( $block_name, $block_style_name ) { */ function block_has_support( $block_type, $feature, $default_value = false ) { $block_support = $default_value; - if ( $block_type && property_exists( $block_type, 'supports' ) ) { + if ( $block_type instanceof WP_Block_Type ) { if ( is_array( $feature ) && count( $feature ) === 1 ) { $feature = $feature[0]; } diff --git a/wp-includes/version.php b/wp-includes/version.php index 34dc5d625a..ba30f73008 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.4-alpha-56677'; +$wp_version = '6.4-alpha-56678'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.