Return the last JSON parser error as a string
If json_last_error() is not available a generic message will be returned.
@ignore
protected function jsonLastErrorString() {
if ($this->jsonLastErrorExists) {
switch (json_last_error()) {
case JSON_ERROR_NONE:
return null;
case JSON_ERROR_DEPTH:
return "JSON Parse error: the maximum stack depth has been exceeded";
case JSON_ERROR_STATE_MISMATCH:
return "JSON Parse error: invalid or malformed JSON";
case JSON_ERROR_CTRL_CHAR:
return "JSON Parse error: control character error, possibly incorrectly encoded";
case JSON_ERROR_SYNTAX:
return "JSON Parse syntax error";
case JSON_ERROR_UTF8:
return "JSON Parse error: malformed UTF-8 characters, possibly incorrectly encoded";
default:
return "JSON Parse error: unknown";
}
}
else {
return "JSON Parse error";
}
}