com php-src: Add missing bits to php_json.h: ext/json/j son.c ext/json/php_json.h
| From: | Jakub Zelenka | Date: | Tue, 25 Nov 2014 20:36:41 +0000 |
| Subject: | com php-src: Add missing bits to php_json.h: ext/json/j son.c ext/json/php_json.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-84722@lists.php.net to get a copy of this message | ||
Commit: a4e59c39a7390ddea47ab10e21722926845f3e10
Author: Jakub Zelenka <bukka@php.net> Tue, 25 Nov 2014 20:36:41 +0000
Parents: e18dd67975d2c00974c8cbb8ccdf1b8093a43ed4
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=a4e59c39a7390ddea47ab10e21722926845f3e10
Log:
Add missing bits to php_json.h
Changed paths:
M ext/json/json.c
M ext/json/php_json.h
Diff:
diff --git a/ext/json/json.c b/ext/json/json.c
index d120aa9..8042f70 100644
--- a/ext/json/json.c
+++ b/ext/json/json.c
@@ -195,7 +195,7 @@ static PHP_FUNCTION(json_encode)
zval *parameter;
smart_str buf = {0};
zend_long options = 0;
- zend_long depth = JSON_PARSER_DEFAULT_DEPTH;
+ zend_long depth = PHP_JSON_PARSER_DEFAULT_DEPTH;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|ll", ¶meter,
&options, &depth) == FAILURE) {
return;
@@ -224,7 +224,7 @@ static PHP_FUNCTION(json_decode)
char *str;
size_t str_len;
zend_bool assoc = 0; /* return JS objects as PHP objects by default */
- zend_long depth = JSON_PARSER_DEFAULT_DEPTH;
+ zend_long depth = PHP_JSON_PARSER_DEFAULT_DEPTH;
zend_long options = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|bll", &str, &str_len,
&assoc, &depth, &options) == FAILURE) {
diff --git a/ext/json/php_json.h b/ext/json/php_json.h
index da6eb12..2e0bc1b 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);