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
This commit is contained in:
youknowriad 2024-02-27 10:15:13 +00:00
parent f274631e5c
commit 9f0595ab4a
2 changed files with 7 additions and 1 deletions

View File

@ -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;

View File

@ -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.