Commit fd6357ae7b for wordpress.org
commit fd6357ae7bde138ecfd7b24969ed19d013d9b6d3
Author: ramonopoly <ramonopoly@git.wordpress.org>
Date: Mon Nov 4 02:34:16 2024 +0000
Theme JSON Resolver: remove theme json merge in resolve_theme_file_uris
This commit affects `WP_Theme_JSON_Resolver::resolve_theme_file_uris()`.
When setting resolved URIs in an incoming theme json object, this commit removes the unnecessary call to `WP_Theme_JSON->merge()`.
Why? `WP_Theme_JSON_Resolver::resolve_theme_file_uris()` only needs to set values for paths in the raw theme json object. It can then return a new theme object based on the updated JSON source. There's no need for a full and possibly expensive merge.
Follow-up to [61588].
Props ramonopoly, aaronrobertshaw, andrewserong.
Fixes #62329.
Built from https://develop.svn.wordpress.org/trunk@59338
git-svn-id: http://core.svn.wordpress.org/trunk@58724 1a063a9b-81f0-0310-95a4-ce76da25c4cd
diff --git a/wp-includes/class-wp-theme-json-resolver.php b/wp-includes/class-wp-theme-json-resolver.php
index d63a84353c..3246992a42 100644
--- a/wp-includes/class-wp-theme-json-resolver.php
+++ b/wp-includes/class-wp-theme-json-resolver.php
@@ -933,18 +933,14 @@ class WP_Theme_JSON_Resolver {
return $theme_json;
}
- $resolved_theme_json_data = array(
- 'version' => WP_Theme_JSON::LATEST_SCHEMA,
- );
+ $resolved_theme_json_data = $theme_json->get_raw_data();
foreach ( $resolved_urls as $resolved_url ) {
$path = explode( '.', $resolved_url['target'] );
_wp_array_set( $resolved_theme_json_data, $path, $resolved_url['href'] );
}
- $theme_json->merge( new WP_Theme_JSON( $resolved_theme_json_data ) );
-
- return $theme_json;
+ return new WP_Theme_JSON( $resolved_theme_json_data );
}
/**
diff --git a/wp-includes/version.php b/wp-includes/version.php
index aa3238388b..292679e998 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '6.8-alpha-59337';
+$wp_version = '6.8-alpha-59338';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.