Re: [RFC] Slim POST data (was: PHP-5.6 and $HTTP_RAW_POST_DATA)

From: Date: Sat, 23 Nov 2013 21:40:00 +0000
Subject: Re: [RFC] Slim POST data (was: PHP-5.6 and $HTTP_RAW_POST_DATA)
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-70332@lists.php.net to get a copy of this message
On Tue, Nov 19, 2013 at 10:46 AM, Michael Wallner <mike@php.net> wrote:

> On 19 November 2013 02:38, Yasuo Ohgaki <yohgaki@ohgaki.net> wrote:
> > Hi Julien,
> >
> > On Mon, Nov 18, 2013 at 10:33 PM, Julien Pauli <jpauli@php.net> wrote:
> >>
> >> Please, remember that our release process forbidds BC breaks.
> >>
> >> I suggest reintroducing the feature, together with
> >> always_populate_raw_post_data (like the old behavior).
> >
> >
> > What we need is vote for the change?
> >
> > Mike, could you prepare RFC whether we keep the ini setting or just use
> > "input://".
> > I think it's time to vote.
>
> Here you go, https://wiki.php.net/rfc/slim_post_data
> Though, with only two supporters, chances are low.
>
>
> --
> Regards,
> Mike
>

After thinking about this, I think I figured out a way to provide this
improvement in 5.6 without the BC break and marking the old behavior
deprecated so people using it can prepare for the removal of
$HTTP_RAW_POST_DATA.
before I describe it, here is some context, feel free to point out any
error/misunderstanding:

   - $HTTP_RAW_POST_DATA is a global, but not a superglobal, which means we
   can't really track and trigger an E_DEPRECATED when accessed, because that
   would add an overhead for any access for global variables.
   - $HTTP_RAW_POST_DATA (up until the introduction of this improvement)
   will be populated if enable_post_data_reading is not set to Off(this ini is
   present since php 5.4) and any of these conditions are met:
   - the always_populate_raw_post_data ini is set to true
      - php is provided with an unrecognized MIME/content type
      - the change in master(which was then branched to 5.6) removed
   the always_populate_raw_post_data ini settings and the $HTTP_RAW_POST_DATA
   global, so it will be never automatically populated.
   - this breaks BC

Here is what I would propose:

   - reintroduce always_populate_raw_post_data, but turn it into an integer
   from a bool to an entry, which can take -1/0/1 as possible values, where 0
   and 1 are the old On and Off behavior, and -1 would disable the population
   of $HTTP_RAW_POST_DATA completely, this way people who want the performance
   gain can opt-in.
   - reintroduce the population of the $HTTP_RAW_POST_DATA via reading the
   data from the new stream which Mike introduced, this way we would keep BC
   for those who doesn't explicitly opt-in for this new feature.
   - trigger an E_DEPRECATED error when the always_populate_raw_post_data
   ini setting is (explicitly or implicitly via not specifying) is set to
   anything else but -1, with an error message, which tells people that
   $HTTP_RAW_POST_DATA will go away in the future.

what do you think?

-- 
Ferenc Kovács
@Tyr43l - http://tyrael.hu


Thread (32 messages)

« previous php.internals (#70332) next »