]> granicus.if.org Git - php/commitdiff
Add E_DEPRECATED when populating $HTTP_RAW_POST_DATA
authorMichael Wallner <mike@php.net>
Tue, 10 Dec 2013 14:35:41 +0000 (15:35 +0100)
committerMichael Wallner <mike@php.net>
Mon, 30 Dec 2013 13:28:43 +0000 (14:28 +0100)
main/php_content_types.c
main/php_variables.c
tests/basic/024.phpt
tests/basic/026.phpt

index d15f6a709d47ed57c58c4755b9497c7c4e7743fc..ebc879bcb2ba4b98edb64cd9207b15803e3209fa 100644 (file)
@@ -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.");
                }
        }
 }
index ab9aee3ae3c424ab5f591c096f526f1e6dfc9f98..9e2675624b47104a5a7f6d99ba1d257bfc5441ed 100644 (file)
@@ -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);
index bf8a206b3ac9d3086d2bf216535afa3e40f25b5b..2e046c0cd830b25823da7ab4157910f06bbb730a 100644 (file)
@@ -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"
index b98a31f430772d3c2b9364e87959248bca585fbf..a3e34f49f27fd681469d7f7cfbadd1aae289be49 100644 (file)
@@ -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"