From b4920d7ad19ae6704e10cb29fca652b47e1bc61f Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Wed, 9 Jan 2013 13:14:40 +0000 Subject: [PATCH] Fix bug #63947 $_POST set as NULL for GET when Content-Type is set as application/json --- php_http_env.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/php_http_env.c b/php_http_env.c index 4f239e5..c8c3d2c 100644 --- a/php_http_env.c +++ b/php_http_env.c @@ -1019,9 +1019,13 @@ PHP_METHOD(HttpEnv, cleanPersistentHandles) static SAPI_POST_HANDLER_FUNC(php_http_json_post_handler) { if (SG(request_info).raw_post_data) { - zval_dtor(arg); - ((zval *) arg)->type = IS_NULL; - php_json_decode(arg, SG(request_info).raw_post_data, SG(request_info).raw_post_data_length, 1, PG(max_input_nesting_level) TSRMLS_CC); + zval *zarg = arg; + zval_dtor(zarg); + ZVAL_NULL(zarg); + php_json_decode(zarg, SG(request_info).raw_post_data, SG(request_info).raw_post_data_length, 1, PG(max_input_nesting_level) TSRMLS_CC); + if (Z_TYPE_P(zarg) == IS_NULL) { + array_init(zarg); + } } } -- 2.30.2