Understanding the Deprecation Warning for $HTTP_RAW_POST_DATA
In PHP 5.6.0, a warning message is displayed regarding the deprecation of automatic population of the $HTTP_RAW_POST_DATA variable:
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.
Confusion Over Warning Interpretation
This message has led to confusion, as it suggests that the warning can be suppressed by setting 'always_populate_raw_post_data' to '-1'. However, this is not the case.
Actual Issue
The true issue lies in the fact that setting 'always_populate_raw_post_data' to 0 (disabled) does not completely prevent the population of $HTTP_RAW_POST_DATA. In certain circumstances, data still gets populated into this variable.
Solution
To resolve this problem, set 'always_populate_raw_post_data' to '-1'. This will not only suppress the warning but also completely disable the population of $HTTP_RAW_POST_DATA.
Explanation
The 'always_populate_raw_post_data' setting has three possible values:
The above is the detailed content of Why is `$HTTP_RAW_POST_DATA` Deprecated in PHP and How Can I Fix the Warning?. For more information, please follow other related articles on the PHP Chinese website!