X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=php_http_env.c;h=2969d1a4fbe5b19bb0e5daf354e022ccabd948e2;hp=02365fa54c99355f9b196c2bd451e3d885e83a8f;hb=34a2055472bf6640874dbb61d640f9901e1d02aa;hpb=dd6fe81738902587044b90488b953a108e6e8d6a diff --git a/php_http_env.c b/php_http_env.c index 02365fa..2969d1a 100644 --- a/php_http_env.c +++ b/php_http_env.c @@ -15,8 +15,6 @@ PHP_RINIT_FUNCTION(http_env) { - PHP_HTTP_G->env.request.time = sapi_get_request_time(TSRMLS_C); - /* populate form data on non-POST requests */ if (SG(request_info).request_method && strcasecmp(SG(request_info).request_method, "POST") && SG(request_info).content_type && *SG(request_info).content_type) { uint ct_len = strlen(SG(request_info).content_type); @@ -969,18 +967,18 @@ static SAPI_POST_HANDLER_FUNC(php_http_json_post_handler) #endif if (json_len) { - zval_dtor(zarg); - ZVAL_NULL(zarg); - php_json_decode(zarg, json_str, json_len, 1, PG(max_input_nesting_level) TSRMLS_CC); + zval zjson; + + INIT_ZVAL(zjson); + php_json_decode(&zjson, json_str, json_len, 1, PG(max_input_nesting_level) TSRMLS_CC); + if (Z_TYPE(zjson) != IS_NULL) { + zval_dtor(zarg); + ZVAL_COPY_VALUE(zarg, (&zjson)); + } } #if PHP_VERSION_ID >= 50600 STR_FREE(json_str); #endif - - /* always let $_POST be array() */ - if (Z_TYPE_P(zarg) == IS_NULL) { - array_init(zarg); - } } static void php_http_env_register_json_handler(TSRMLS_D)