protected function jsonDecode($json) { $obj = json_decode($json); Zotero_Utilities::cleanStringRecursive($obj); $this->checkJSONError(); return $obj; }
protected function jsonDecode($json) { $obj = json_decode($json); Zotero_Utilities::cleanStringRecursive($obj); switch (json_last_error()) { case JSON_ERROR_DEPTH: $error = 'Maximum stack depth exceeded'; break; case JSON_ERROR_CTRL_CHAR: $error = 'Unexpected control character found'; break; case JSON_ERROR_SYNTAX: $error = 'Syntax error, malformed JSON'; break; case JSON_ERROR_NONE: default: $error = ''; } if (!empty($error)) { throw new Exception("JSON Error: {$error}", Z_ERROR_INVALID_INPUT); } return $obj; }