summaryrefslogtreecommitdiff
path: root/ext/json/php_json.h
diff options
context:
space:
mode:
authorJakub Zelenka <bukka@php.net>2014-11-25 20:36:41 +0000
committerJakub Zelenka <bukka@php.net>2014-11-25 20:36:41 +0000
commita4e59c39a7390ddea47ab10e21722926845f3e10 (patch)
tree5887f7da2dd997642c54b84616bb2ad7516bd92f /ext/json/php_json.h
parente18dd67975d2c00974c8cbb8ccdf1b8093a43ed4 (diff)
downloadphp-git-a4e59c39a7390ddea47ab10e21722926845f3e10.tar.gz
Add missing bits to php_json.h
Diffstat (limited to 'ext/json/php_json.h')
-rw-r--r--ext/json/php_json.h32
1 files changed, 18 insertions, 14 deletions
diff --git a/ext/json/php_json.h b/ext/json/php_json.h
index da6eb12cbd..2e0bc1b2ee 100644
--- a/ext/json/php_json.h
+++ b/ext/json/php_json.h
@@ -37,20 +37,6 @@ extern zend_module_entry json_module_entry;
#include "TSRM.h"
#endif
-ZEND_BEGIN_MODULE_GLOBALS(json)
- int encoder_depth;
- int error_code;
- int encode_max_depth;
-ZEND_END_MODULE_GLOBALS(json)
-
-#ifdef ZTS
-# define JSON_G(v) TSRMG(json_globals_id, zend_json_globals *, v)
-#else
-# define JSON_G(v) (json_globals.v)
-#endif
-
-PHP_JSON_API void php_json_encode(smart_str *buf, zval *val, int options TSRMLS_DC);
-PHP_JSON_API void php_json_decode_ex(zval *return_value, char *str, size_t str_len, zend_long options, zend_long depth TSRMLS_DC);
extern PHP_JSON_API zend_class_entry *php_json_serializable_ce;
/* error codes */
@@ -83,10 +69,28 @@ typedef enum {
#define PHP_JSON_OUTPUT_ARRAY 0
#define PHP_JSON_OUTPUT_OBJECT 1
+/* default depth */
+#define PHP_JSON_PARSER_DEFAULT_DEPTH 512
+
+ZEND_BEGIN_MODULE_GLOBALS(json)
+ int encoder_depth;
+ int encode_max_depth;
+ php_json_error_code error_code;
+ZEND_END_MODULE_GLOBALS(json)
+
+#ifdef ZTS
+# define JSON_G(v) TSRMG(json_globals_id, zend_json_globals *, v)
+#else
+# define JSON_G(v) (json_globals.v)
+#endif
+
/* json_decode() options */
#define PHP_JSON_OBJECT_AS_ARRAY (1<<0)
#define PHP_JSON_BIGINT_AS_STRING (1<<1)
+PHP_JSON_API void php_json_encode(smart_str *buf, zval *val, int options TSRMLS_DC);
+PHP_JSON_API void php_json_decode_ex(zval *return_value, char *str, size_t str_len, zend_long options, zend_long depth TSRMLS_DC);
+
static inline void php_json_decode(zval *return_value, char *str, int str_len, zend_bool assoc, zend_long depth TSRMLS_DC)
{
php_json_decode_ex(return_value, str, str_len, assoc ? PHP_JSON_OBJECT_AS_ARRAY : 0, depth TSRMLS_CC);