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
This commit is contained in:
ramonopoly 2024-11-04 02:34:16 +00:00
parent 2dfcb9ea56
commit fd6357ae7b
2 changed files with 3 additions and 7 deletions

View File

@ -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 );
}
/**

View File

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