Returns if an error occurred during most recent JSON encode/decode.
Description
Strings to be translated will be in format like "Encoding error: Maximum stack depth exceeded".
Source
protected function get_json_last_error() {
$last_error_code = json_last_error();
if ( JSON_ERROR_NONE === $last_error_code || empty( $last_error_code ) ) {
return false;
}
return json_last_error_msg();
}
Changelog
Version | Description |
---|---|
4.4.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.