diff options
author | Sara Golemon <pollita@php.net> | 2010-05-21 22:59:58 +0000 |
---|---|---|
committer | Sara Golemon <pollita@php.net> | 2010-05-21 22:59:58 +0000 |
commit | 6eb4218433e5b2af2974648b31ca434b1aa4e314 (patch) | |
tree | 7107a79d39863c12df805228fc20dd27329c306c /ext/json/JSON_parser.h | |
parent | a25482105ec71b40f14d1f6bf1ce0ee72622047b (diff) | |
download | php-git-6eb4218433e5b2af2974648b31ca434b1aa4e314.tar.gz |
Add JSON_BIGINT_AS_STRING for json_decode() to parse large numbers
as strings rather than casting to double and loosing precision.
Diffstat (limited to 'ext/json/JSON_parser.h')
-rw-r--r-- | ext/json/JSON_parser.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/ext/json/JSON_parser.h b/ext/json/JSON_parser.h index 746190bb35..e02c9fc534 100644 --- a/ext/json/JSON_parser.h +++ b/ext/json/JSON_parser.h @@ -5,6 +5,7 @@ #include "php.h" #include "ext/standard/php_smart_str.h" +#include "php_json.h" #define JSON_PARSER_DEFAULT_DEPTH 512 @@ -28,6 +29,12 @@ enum error_codes { }; 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 parse_JSON_ex(JSON_parser jp, zval *z, unsigned short utf16_json[], int length, int options TSRMLS_DC); extern int free_JSON_parser(JSON_parser jp); + +static inline int parse_JSON(JSON_parser jp, zval *z, unsigned short utf16_json[], int length, int assoc TSRMLS_DC) +{ + parse_JSON_ex(jp, z, utf16_json, length, assoc ? PHP_JSON_OBJECT_AS_ARRAY : 0 TSRMLS_CC); +} + #endif |