From 9f0595ab4a0f2d59e5ac2b874e023d0af5b7f4a0 Mon Sep 17 00:00:00 2001 From: youknowriad Date: Tue, 27 Feb 2024 10:15:13 +0000 Subject: [PATCH] Editor: Check for null values in Theme JSON to cater for blockGap. When resolving theme.json preset variables, add a check to make sure the value is not empty before we run it through strpos() and preg_match_all(). Props ramonopoly, mukesh27, get_dave. Fixes #60613. Built from https://develop.svn.wordpress.org/trunk@57716 git-svn-id: http://core.svn.wordpress.org/trunk@57217 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-theme-json.php | 6 ++++++ wp-includes/version.php | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/wp-includes/class-wp-theme-json.php b/wp-includes/class-wp-theme-json.php index 6fd954705e..711f7a8511 100644 --- a/wp-includes/class-wp-theme-json.php +++ b/wp-includes/class-wp-theme-json.php @@ -3857,12 +3857,18 @@ class WP_Theme_JSON { * Replaces CSS variables with their values in place. * * @since 6.3.0 + * @since 6.5.0 Check for empty style before processing its value. + * * @param array $styles CSS declarations to convert. * @param array $values key => value pairs to use for replacement. * @return array */ private static function convert_variables_to_value( $styles, $values ) { foreach ( $styles as $key => $style ) { + if ( empty( $style ) ) { + continue; + } + if ( is_array( $style ) ) { $styles[ $key ] = self::convert_variables_to_value( $style, $values ); continue; diff --git a/wp-includes/version.php b/wp-includes/version.php index 2c80c09eae..d2e6742657 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.5-beta2-57715'; +$wp_version = '6.5-beta2-57716'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.