From: Michael Wallner Date: Tue, 10 Dec 2013 14:35:41 +0000 (+0100) Subject: Add E_DEPRECATED when populating $HTTP_RAW_POST_DATA X-Git-Tag: php-5.6.0alpha1~61 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4797f7ad16bc65bda9dca10232c8e0c62a6830ea;p=php Add E_DEPRECATED when populating $HTTP_RAW_POST_DATA --- diff --git a/main/php_content_types.c b/main/php_content_types.c index d15f6a709d..ebc879bcb2 100644 --- a/main/php_content_types.c +++ b/main/php_content_types.c @@ -65,6 +65,12 @@ SAPI_API SAPI_POST_READER_FUNC(php_default_post_reader) php_stream_rewind(SG(request_info).request_body); SET_VAR_STRINGL("HTTP_RAW_POST_DATA", data, length); + + sapi_module.sapi_error(E_DEPRECATED, + "Automatically populating $HTTP_RAW_POST_DATA is deprecated and " + "will be removed in a future version. To avoid this warning set " + "'always_populate_raw_post_data' to '-1' in php.ini and use the " + "php://input stream instead."); } } } diff --git a/main/php_variables.c b/main/php_variables.c index ab9aee3ae3..9e2675624b 100644 --- a/main/php_variables.c +++ b/main/php_variables.c @@ -734,7 +734,6 @@ static zend_bool php_auto_globals_create_post(const char *name, uint name_len TS if (PG(variables_order) && (strchr(PG(variables_order),'P') || strchr(PG(variables_order),'p')) && - !SG(headers_sent) && SG(request_info).request_method && !strcasecmp(SG(request_info).request_method, "POST")) { sapi_module.treat_data(PARSE_POST, NULL, NULL TSRMLS_CC); diff --git a/tests/basic/024.phpt b/tests/basic/024.phpt index bf8a206b3a..2e046c0cd8 100644 --- a/tests/basic/024.phpt +++ b/tests/basic/024.phpt @@ -10,6 +10,9 @@ a=ABC&y=XYZ&c[]=1&c[]=2&c[a]=3 var_dump($_POST, $HTTP_RAW_POST_DATA); ?> --EXPECT-- +Deprecated: Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input stream instead. in Unknown on line 0 + +Warning: Cannot modify header information - headers already sent in Unknown on line 0 array(3) { ["a"]=> string(3) "ABC" diff --git a/tests/basic/026.phpt b/tests/basic/026.phpt index b98a31f430..a3e34f49f2 100644 --- a/tests/basic/026.phpt +++ b/tests/basic/026.phpt @@ -10,6 +10,9 @@ a=1&b=ZYX var_dump($_POST, $HTTP_RAW_POST_DATA); ?> --EXPECT-- +Deprecated: Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input stream instead. in Unknown on line 0 + +Warning: Cannot modify header information - headers already sent in Unknown on line 0 array(0) { } string(9) "a=1&b=ZYX"