diff options
author | Scott MacVicar <scottmac@php.net> | 2008-12-19 02:00:57 +0000 |
---|---|---|
committer | Scott MacVicar <scottmac@php.net> | 2008-12-19 02:00:57 +0000 |
commit | fdf2d1e46f4b6bd08e600b08b8d29ac7f694d2cf (patch) | |
tree | 5fa918740a3b319290d04df43367084abfcd3421 /ext/json/JSON_parser.h | |
parent | c310143ac7b06b7e778a99d26ee2690c7e4ea33c (diff) | |
download | php-git-fdf2d1e46f4b6bd08e600b08b8d29ac7f694d2cf.tar.gz |
MFH Add json_last_error() for getting a bit of information about what failed during a decode, also fixes a segfault when we have [1}
[DOC]
Diffstat (limited to 'ext/json/JSON_parser.h')
-rw-r--r-- | ext/json/JSON_parser.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/ext/json/JSON_parser.h b/ext/json/JSON_parser.h index 9aab62a912..0ed7e52a8f 100644 --- a/ext/json/JSON_parser.h +++ b/ext/json/JSON_parser.h @@ -12,12 +12,20 @@ typedef struct JSON_parser_struct { int state; int depth; int top; - int error; + int error_code; int* stack; zval *the_zstack[JSON_PARSER_MAX_DEPTH]; } * JSON_parser; +enum error_codes { + PHP_JSON_ERROR_NONE = 0, + PHP_JSON_ERROR_DEPTH, + PHP_JSON_ERROR_STATE_MISMATCH, + PHP_JSON_ERROR_CTRL_CHAR, + PHP_JSON_ERROR_SYNTAX, +}; + extern JSON_parser new_JSON_parser(int depth); extern int parse_JSON(JSON_parser jp, zval *z, unsigned short utf16_json[], int length, int assoc TSRMLS_DC); extern int free_JSON_parser(JSON_parser jp); |