18 foreach ($argv as $js_file) {
19 $js = file_get_contents($js_file);
21 error_log(sprintf(
"Error reading content from '%s'.", $js_file));
24 $js_dec = json_decode($js);
25 if ($js_dec === null) {
26 error_log(sprintf(
"Error decoding json from '%s': %s.", $js_file,
json_last_errmsg()));
29 foreach ($js_dec as $k => $v) {
50 if ($errcode === null) {
51 $errcode = json_last_error();
55 return 'JSON_ERROR_NONE';
58 case JSON_ERROR_DEPTH:
59 return 'JSON_ERROR_DEPTH';
62 case JSON_ERROR_STATE_MISMATCH:
63 return 'JSON_ERROR_STATE_MISMATCH';
66 case JSON_ERROR_CTRL_CHAR:
67 return 'JSON_ERROR_CTRL_CHAR';
70 case JSON_ERROR_SYNTAX:
71 return 'JSON_ERROR_SYNTAX';
75 return 'JSON_ERROR_UTF8';
78 return sprintf(
"error code '%s'", $errcode);