Make WordPress Core


Ignore:
Timestamp:
02/27/2024 10:13:13 AM (11 months ago)
Author:
youknowriad
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-theme-json.php

    r57547 r57716  
    38583858     *
    38593859     * @since 6.3.0
     3860     * @since 6.5.0 Check for empty style before processing its value.
     3861     *
    38603862     * @param array $styles CSS declarations to convert.
    38613863     * @param array $values key => value pairs to use for replacement.
     
    38643866    private static function convert_variables_to_value( $styles, $values ) {
    38653867        foreach ( $styles as $key => $style ) {
     3868            if ( empty( $style ) ) {
     3869                continue;
     3870            }
     3871
    38663872            if ( is_array( $style ) ) {
    38673873                $styles[ $key ] = self::convert_variables_to_value( $style, $values );
Note: See TracChangeset for help on using the changeset viewer.