From: Michael Wallner Date: Wed, 9 Jan 2013 13:14:40 +0000 (+0000) Subject: Fix bug #63947 $_POST set as NULL for GET when Content-Type is set as application... X-Git-Tag: RELEASE_2_1_0_RC3~10^2^2~43 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=b4920d7ad19ae6704e10cb29fca652b47e1bc61f;p=m6w6%2Fext-http Fix bug #63947 $_POST set as NULL for GET when Content-Type is set as application/json --- 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); + } } }