Skip to content

Commit 3346f24

Browse files
committed
Check error code instead of string
1 parent b2a77df commit 3346f24

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

lib/global-styles.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ function gutenberg_experimental_global_styles_get_from_file( $file_path ) {
8181
true
8282
);
8383

84-
$json_decoding_error = json_last_error_msg();
85-
if ( 'No error' !== $json_decoding_error ) {
86-
error_log( 'Error when decoding file schema: ' . $json_decoding_error );
84+
$json_decoding_error = json_last_error();
85+
if ( JSON_ERROR_NONE !== $json_decoding_error ) {
86+
error_log( 'Error when decoding file schema: ' . json_last_error_msg() );
8787
return $config;
8888
}
8989

@@ -105,9 +105,9 @@ function gutenberg_experimental_global_styles_get_user() {
105105
if ( array_key_exists( 'post_content', $user_cpt ) ) {
106106
$decoded_data = json_decode( $user_cpt['post_content'], true );
107107

108-
$json_decoding_error = json_last_error_msg();
109-
if ( 'No error' !== $json_decoding_error ) {
110-
error_log( 'Error when decoding user schema: ' . $json_decoding_error );
108+
$json_decoding_error = json_last_error();
109+
if ( JSON_ERROR_NONE !== $json_decoding_error ) {
110+
error_log( 'Error when decoding user schema: ' . json_last_error_msg() );
111111
return $config;
112112
}
113113

0 commit comments

Comments
 (0)