Re: always_populate_raw_post_data E_DEPRECATED thrown by default
| From: | Rowan Collins | Date: | Mon, 20 Oct 2014 08:04:25 +0000 |
| Subject: | Re: always_populate_raw_post_data E_DEPRECATED thrown by default | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-78155@lists.php.net to get a copy of this message | ||
On 20 October 2014 05:48:04 GMT+01:00, Davey Shafik <davey@php.net> wrote:
>Hey folks,
>
>A thread on reddit (here:
>https://www.reddit.com/r/PHP/comments/2jpzzj/php_56_throws_e_deprecated_by_default_for_no/)
>noted that in 5.6 there is an E_DEPRECATED thrown if
>"always_populate_raw_post_data" is set to anything but -1
>
>There is an issue in that the default value is 0 (see:
>http://lxr.php.net/xref/PHP_5_6/main/main.c#641 I believe).
>
>This means that the E_DEPRECATED is always thrown in the default case,
>and
>if you've never cared about this setting, and don't use it, you may now
>be
>seeing an unnecessary warning.
>
>I'd like to set the default to -1.
>
>The php.ini-* files state:
>
>; Always populate the $HTTP_RAW_POST_DATA variable. PHP's default
>behavior
>is
>; to disable this feature and it will be removed in a future version.
>; If post reading is disabled through enable_post_data_reading,
>; $HTTP_RAW_POST_DATA is *NOT* populated.
>; http://php.net/always-populate-raw-post-data
>;always_populate_raw_post_data = -1
>
>Being as the current default is not to populate it, and (currently) -1
>has
>the same affect and also suppresses the E_DEPRECATED, I don't think
>this
>change is a BC issue.
>
>The other option is to only throw the E_DEPRECATED when it's set to 1
>(as
>you are actively trying to use the feature).
>
>Thoughts?
>
>Thanks,
>
>- Davey
I remember there being a fair amount of back and forth about this on the list when the change was
made.
The problem is that people who have it set to 0/false - either explicitly, or because they've
never touched the default value - may still be relying on $HTTP_RAW_POST_DATA, since the default is
basically for it to be populated whenever $_POST isn't.
Until 5.6, there were a handful of situations where php://input didn't work as desired, but
with these resolved, the idea is to encourage everyone to avoid $HTTP_RAW_POST_DATA completely, and
actively set their configuration to never populate it.
So, messy though it is to have the default be deprecated, that is actually a deliberate intention.
Distributors can of course include php.ini files which set this to -1 for new users.
Regards,
--
Rowan Collins
[IMSoP]