From: Ilia Alshanetsky Date: Mon, 7 May 2007 23:27:59 +0000 (+0000) Subject: Register RAW_POST_DATA even when always_populate_raw_post_data is off in X-Git-Tag: php-5.2.3RC1~132 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=420352d8b5320730689ac3f3772c372c78af3a74;p=php Register RAW_POST_DATA even when always_populate_raw_post_data is off in instances where content type is not known --- diff --git a/main/php_content_types.c b/main/php_content_types.c index fcd431d7ce..8dc55f89d7 100644 --- a/main/php_content_types.c +++ b/main/php_content_types.c @@ -47,7 +47,9 @@ SAPI_API SAPI_POST_READER_FUNC(php_default_post_reader) sapi_read_standard_form_data(TSRMLS_C); } - if (PG(always_populate_raw_post_data) && SG(request_info).post_data) { + /* For unknown content types we create HTTP_RAW_POST_DATA even if always_populate_raw_post_data off, + * this is in-effecient, but we need to keep doing it for BC reasons (for now) */ + if ((PG(always_populate_raw_post_data) || NULL == SG(request_info).post_entry) && SG(request_info).post_data) { length = SG(request_info).post_data_length; data = estrndup(SG(request_info).post_data, length); SET_VAR_STRINGL("HTTP_RAW_POST_DATA", data, length); diff --git a/tests/basic/026.phpt b/tests/basic/026.phpt new file mode 100644 index 0000000000..3d0d9df1ec --- /dev/null +++ b/tests/basic/026.phpt @@ -0,0 +1,19 @@ +--TEST-- +Registration of HTTP_RAW_POST_DATA due to unknown content-type +--INI-- +magic_quotes_gpc=0 +always_populate_raw_post_data=0 +--SKIPIF-- + +--POST_RAW-- +Content-Type: unknown/type +a=1&b=ZYX +--FILE-- + +--EXPECT-- +array(0) { +} +string(10) "a=1&b=ZYX +" \ No newline at end of file