Sage 9 file_get_contents warnings after update WP to 6.3

In Wordpress 6.3 the code in the file class-wp-theme-json-resolver.php was changed.

...
$theme_json_file = static::get_file_path_from_theme( 'theme.json' );
$wp_theme        = wp_get_theme();
if ( '' !== $theme_json_file ) {
	$theme_json_data = static::read_json_file( $theme_json_file );
...

Is now:

...
$wp_theme        = wp_get_theme();
$theme_json_file = $wp_theme->get_file_path( 'theme.json' );
if ( is_readable( $theme_json_file ) ) {
	$theme_json_data = static::read_json_file( $theme_json_file );
...

If you put a theme.json in /themes/themename/resources, nothing happens. You get back an empty array. But if you change $theme_json_file = $wp_theme->get_file_path( 'theme.json' ); to $theme_json_file = '/srv/www/.../current/web/app/themes/...-theme/resources/theme.json'; the warnings are gone .

But that is not a good solution :frowning:

1 Like