Add E_DEPRECATED when populating $HTTP_RAW_POST_DATA

This commit is contained in:
Michael Wallner 2013-12-10 15:35:41 +01:00
parent 729f85fad7
commit 4797f7ad16
4 changed files with 12 additions and 1 deletions

View 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.");
}
}
}

View 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);

View 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"

View 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"