This source file includes following definitions.
- php_json_decode
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 #ifndef PHP_JSON_H
22 #define PHP_JSON_H
23
24 #define PHP_JSON_VERSION "1.2.1"
25 #include "ext/standard/php_smart_str.h"
26
27 extern zend_module_entry json_module_entry;
28 #define phpext_json_ptr &json_module_entry
29
30 #if defined(PHP_WIN32) && defined(JSON_EXPORTS)
31 #define PHP_JSON_API __declspec(dllexport)
32 #else
33 #define PHP_JSON_API PHPAPI
34 #endif
35
36 #ifdef ZTS
37 #include "TSRM.h"
38 #endif
39
40 ZEND_BEGIN_MODULE_GLOBALS(json)
41 int encoder_depth;
42 int error_code;
43 int encode_max_depth;
44 ZEND_END_MODULE_GLOBALS(json)
45
46 #ifdef ZTS
47 # define JSON_G(v) TSRMG(json_globals_id, zend_json_globals *, v)
48 #else
49 # define JSON_G(v) (json_globals.v)
50 #endif
51
52 PHP_JSON_API void php_json_encode(smart_str *buf, zval *val, int options TSRMLS_DC);
53 PHP_JSON_API void php_json_decode_ex(zval *return_value, char *str, int str_len, int options, long depth TSRMLS_DC);
54 extern PHP_JSON_API zend_class_entry *php_json_serializable_ce;
55
56
57
58 #define PHP_JSON_HEX_TAG (1<<0)
59 #define PHP_JSON_HEX_AMP (1<<1)
60 #define PHP_JSON_HEX_APOS (1<<2)
61 #define PHP_JSON_HEX_QUOT (1<<3)
62 #define PHP_JSON_FORCE_OBJECT (1<<4)
63 #define PHP_JSON_NUMERIC_CHECK (1<<5)
64 #define PHP_JSON_UNESCAPED_SLASHES (1<<6)
65 #define PHP_JSON_PRETTY_PRINT (1<<7)
66 #define PHP_JSON_UNESCAPED_UNICODE (1<<8)
67 #define PHP_JSON_PARTIAL_OUTPUT_ON_ERROR (1<<9)
68 #define PHP_JSON_PRESERVE_ZERO_FRACTION (1<<10)
69
70
71 #define PHP_JSON_OUTPUT_ARRAY 0
72 #define PHP_JSON_OUTPUT_OBJECT 1
73
74
75 #define PHP_JSON_OBJECT_AS_ARRAY (1<<0)
76 #define PHP_JSON_BIGINT_AS_STRING (1<<1)
77
78 static inline void php_json_decode(zval *return_value, char *str, int str_len, zend_bool assoc, long depth TSRMLS_DC)
79 {
80 php_json_decode_ex(return_value, str, str_len, assoc ? PHP_JSON_OBJECT_AS_ARRAY : 0, depth TSRMLS_CC);
81 }
82
83
84 #endif
85
86
87
88
89
90
91
92
93