note 117393 added to function.json-last-error-msg
| From: | Anonymous | Date: | Wed, 03 Jun 2015 09:34:16 +0000 |
| Subject: | note 117393 added to function.json-last-error-msg | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-202727@lists.php.net to get a copy of this message | ||
Here's an updated version of the function:
<?php
if (!function_exists('json_last_error_msg')) {
function json_last_error_msg() {
static $ERRORS = array(
JSON_ERROR_NONE => 'No error',
JSON_ERROR_DEPTH => 'Maximum stack depth exceeded',
JSON_ERROR_STATE_MISMATCH => 'State mismatch (invalid or malformed JSON)',
JSON_ERROR_CTRL_CHAR => 'Control character error, possibly incorrectly encoded',
JSON_ERROR_SYNTAX => 'Syntax error',
JSON_ERROR_UTF8 => 'Malformed UTF-8 characters, possibly incorrectly encoded'
);
$error = json_last_error();
return isset($ERRORS[$error]) ? $ERRORS[$error] : 'Unknown error';
}
}
?>
----
Server IP: 72.52.91.14
Probable Submitter: 73.35.253.57
----
Manual Page -- http://php.net/manual/en/function.json-last-error-msg.php
Edit -- https://master.php.net/note/edit/117393
Del: integrated -- https://master.php.net/note/delete/117393/integrated
Del: useless -- https://master.php.net/note/delete/117393/useless
Del: bad code -- https://master.php.net/note/delete/117393/bad+code
Del: spam -- https://master.php.net/note/delete/117393/spam
Del: non-english -- https://master.php.net/note/delete/117393/non-english
Del: in docs -- https://master.php.net/note/delete/117393/in+docs
Del: other reasons-- https://master.php.net/note/delete/117393
Reject -- https://master.php.net/note/reject/117393
Search -- https://master.php.net/manage/user-notes.php