From 64c4621fa73522af735c35c23f5494853394531a Mon Sep 17 00:00:00 2001 From: Andrew Serong <14988353+andrewserong@users.noreply.github.com> Date: Tue, 13 Dec 2022 17:32:03 +1100 Subject: [PATCH] Small tweaks based on feedback --- src/wp-includes/class-wp-theme-json.php | 2 +- tests/phpunit/tests/theme/wpThemeJson.php | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/wp-includes/class-wp-theme-json.php b/src/wp-includes/class-wp-theme-json.php index d3eecab46016a..80e1e06087df0 100644 --- a/src/wp-includes/class-wp-theme-json.php +++ b/src/wp-includes/class-wp-theme-json.php @@ -2774,7 +2774,7 @@ protected static function remove_insecure_styles( $input ) { foreach ( static::INDIRECT_PROPERTIES_METADATA as $property => $path ) { $value = _wp_array_get( $input, $path, array() ); if ( - isset( $value ) && + null !== $value && ! is_array( $value ) && static::is_safe_css_declaration( $property, $value ) ) { diff --git a/tests/phpunit/tests/theme/wpThemeJson.php b/tests/phpunit/tests/theme/wpThemeJson.php index 478f38655b444..3021d7231cea5 100644 --- a/tests/phpunit/tests/theme/wpThemeJson.php +++ b/tests/phpunit/tests/theme/wpThemeJson.php @@ -2394,19 +2394,19 @@ public function test_remove_insecure_properties_should_allow_indirect_properties array( 'version' => WP_Theme_JSON::LATEST_SCHEMA, 'styles' => array( + 'spacing' => array( + 'blockGap' => '3em', + ), 'blocks' => array( 'core/social-links' => array( 'spacing' => array( 'blockGap' => array( - 'top' => '1em', 'left' => '2em', + 'top' => '1em', ), ), ), ), - 'spacing' => array( - 'blockGap' => '3em', - ), ), ) ); @@ -2414,23 +2414,23 @@ public function test_remove_insecure_properties_should_allow_indirect_properties $expected = array( 'version' => WP_Theme_JSON::LATEST_SCHEMA, 'styles' => array( + 'spacing' => array( + 'blockGap' => '3em', + ), 'blocks' => array( 'core/social-links' => array( 'spacing' => array( 'blockGap' => array( - 'top' => '1em', 'left' => '2em', + 'top' => '1em', ), ), ), ), - 'spacing' => array( - 'blockGap' => '3em', - ), ), ); - $this->assertEqualSetsWithIndex( $expected, $actual ); + $this->assertSameSetsWithIndex( $expected, $actual ); } /**