Home > Article > Backend Development > Why Does PHP Still Populate `$HTTP_RAW_POST_DATA` Even When `always_populate_raw_post_data` is Disabled?
PHP: Understanding the Deprecated Warning about $HTTP_RAW_POST_DATA
Despite having disabled the always_populate_raw_post_data setting in php.ini, you may encounter a warning indicating that the populating of $HTTP_RAW_POST_DATA is deprecated and will be removed in future versions. However, further investigation reveals that the interpretation of the error message is incorrect.
The solution to this issue lies not in ignoring the warning by setting the value to -1 but in understanding the actual issue. The variable $HTTP_RAW_POST_DATA is populated under specific circumstances, even when always_populate_raw_post_data is set to 0. To completely disable its population, it must be set to -1.
As explained in the PHP RFC, the always_populate_raw_post_data setting now accepts three values:
By setting always_populate_raw_post_data to -1, not only do you avoid the warning, but you also effectively disable the populating of $HTTP_RAW_POST_DATA, resolving the underlying issue.
The above is the detailed content of Why Does PHP Still Populate `$HTTP_RAW_POST_DATA` Even When `always_populate_raw_post_data` is Disabled?. For more information, please follow other related articles on the PHP Chinese website!