Re: RE : Re: [PHP-DEV] [PATCH] Add option to disable POST data processing
| From: | Clint Byrum | Date: | Wed, 08 Dec 2010 15:10:30 +0000 |
| Subject: | Re: RE : Re: [PHP-DEV] [PATCH] Add option to disable POST data processing | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-50912@lists.php.net to get a copy of this message | ||
On Wed, 2010-12-08 at 01:11 +0000, Gustavo Lopes wrote:
> On Wed, 08 Dec 2010 00:45:56 -0000, Tjerk Meesters
> <tjerk.meesters@gmail.com> wrote:
>
> > Don't have much knowledge about the internal workings of the engine, but
> > I'm wondering if it's possible to apply "lazy loading" to the $_POST
> > variable, so that processing only happens if and when it's requested.
> >
> > That way you wouldn't need the ini setting.
>
> In most cases, processing (=parsing) of the POST data already only occurs
> when $_POST is requested; however, previously the data was already
> entirely copied to two or three memory locations.
>
> If you mean making it so that the data is only *read and processed* when
> $_POST is requested, I suppose that would be possible, but I think it
> would require significant code/architectural changes to PHP and to the
> sapis. It would also raise other problems, including backwards
> compatibility breaks, if we wanted the change to bring any benefit.
>
> For instance, current scripts can, in POST requests, read any number of
> times from php://input or $HTTP_RAW_POST_DATA (to simplify, let's say we
> even let go $HTTP_RAW_POST_DATA). For this to be possible, you would have
> to have the data in memory because you're reading from php://input the
> first time, you can't know if it will be read a second time, so you either
> break BC or keep everything in memory just in case there's a second read
> -- and then you're where you started.
>
This example would be solved if during the lazy load you change the
php://input stream to point at the memory location that you read it
into.