-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathhelpers.php
25 lines (24 loc) · 1019 Bytes
/
helpers.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php
if (!function_exists('json_last_error_msg')) {
function json_last_error_msg()
{
switch (json_last_error()) {
case JSON_ERROR_DEPTH:
return 'The maximum stack depth has been exceeded';
case JSON_ERROR_STATE_MISMATCH:
return 'Invalid or malformed JSON';
case JSON_ERROR_CTRL_CHAR:
return 'Control character error, possibly incorrectly encoded';
case JSON_ERROR_SYNTAX:
return 'Syntax error';
case JSON_ERROR_UTF8:
return 'Malformed UTF-8 characters, possibly incorrectly encoded';
case JSON_ERROR_RECURSION:
return 'One or more recursive references in the value to be encoded';
case JSON_ERROR_INF_OR_NAN:
return 'NAN or INF values in the value to be encoded';
case JSON_ERROR_UNSUPPORTED_TYPE:
return 'A value of a type that cannot be encoded was given';
}
}
}