Skip to content

Commit

Permalink
Check error code instead of string
Browse files Browse the repository at this point in the history
  • Loading branch information
oandregal committed Jun 2, 2020
1 parent b2a77df commit 3346f24
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/global-styles.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ function gutenberg_experimental_global_styles_get_from_file( $file_path ) {
true
);

$json_decoding_error = json_last_error_msg();
if ( 'No error' !== $json_decoding_error ) {
error_log( 'Error when decoding file schema: ' . $json_decoding_error );
$json_decoding_error = json_last_error();
if ( JSON_ERROR_NONE !== $json_decoding_error ) {
error_log( 'Error when decoding file schema: ' . json_last_error_msg() );
return $config;
}

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

$json_decoding_error = json_last_error_msg();
if ( 'No error' !== $json_decoding_error ) {
error_log( 'Error when decoding user schema: ' . $json_decoding_error );
$json_decoding_error = json_last_error();
if ( JSON_ERROR_NONE !== $json_decoding_error ) {
error_log( 'Error when decoding user schema: ' . json_last_error_msg() );
return $config;
}

Expand Down

0 comments on commit 3346f24

Please sign in to comment.