Fix bug #63947 $_POST set as NULL for GET when Content-Type is set as application...
authorMichael Wallner <mike@php.net>
Wed, 9 Jan 2013 13:14:40 +0000 (13:14 +0000)
committerMichael Wallner <mike@php.net>
Wed, 9 Jan 2013 13:14:40 +0000 (13:14 +0000)
php_http_env.c

index 4f239e509360aad962fcf129884701c85862d166..c8c3d2c974f845e37fbf93c822d9356350298a8c 100644 (file)
@@ -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);
+               }
        }
 }