From 7fbf2b4a025a05110cf3d720f6f2ca31a0079b09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9?= Date: Fri, 4 Jun 2021 12:13:30 +0200 Subject: [PATCH] Make syntax errors in `theme.json` visible to users (#32404) --- lib/class-wp-theme-json-resolver-gutenberg.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/class-wp-theme-json-resolver-gutenberg.php b/lib/class-wp-theme-json-resolver-gutenberg.php index 987f3e5400fc2..bcdedda86f30b 100644 --- a/lib/class-wp-theme-json-resolver-gutenberg.php +++ b/lib/class-wp-theme-json-resolver-gutenberg.php @@ -74,7 +74,7 @@ private static function read_json_file( $file_path ) { $json_decoding_error = json_last_error(); if ( JSON_ERROR_NONE !== $json_decoding_error ) { - error_log( 'Error when decoding file schema: ' . json_last_error_msg() ); + trigger_error( "Error when decoding a theme.json schema at path $file_path " . json_last_error_msg() ); return $config; } @@ -367,7 +367,7 @@ public static function get_user_data() { $json_decoding_error = json_last_error(); if ( JSON_ERROR_NONE !== $json_decoding_error ) { - error_log( 'Error when decoding user schema: ' . json_last_error_msg() ); + trigger_error( 'Error when decoding a theme.json schema for user data. ' . json_last_error_msg() ); return new WP_Theme_JSON_Gutenberg( $config ); }