Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:50912 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 84589 invoked from network); 8 Dec 2010 15:10:27 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Dec 2010 15:10:27 -0000 Authentication-Results: pb1.pair.com header.from=clint@ubuntu.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=clint@ubuntu.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain ubuntu.com from 65.98.207.160 cause and error) X-PHP-List-Original-Sender: clint@ubuntu.com X-Host-Fingerprint: 65.98.207.160 xenclint.srihosting.com Received: from [65.98.207.160] ([65.98.207.160:33877] helo=xen.spamaps.org) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8A/60-15021-1EF9FFC4 for ; Wed, 08 Dec 2010 10:10:25 -0500 Received: from [192.168.1.102] (76-216-240-245.lightspeed.irvnca.sbcglobal.net [76.216.240.245]) by xen.spamaps.org (Postfix) with ESMTP id F2A0E16011B; Wed, 8 Dec 2010 07:10:21 -0800 (PST) To: Gustavo Lopes Cc: internals@lists.php.net In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Date: Wed, 08 Dec 2010 07:10:30 -0800 Message-ID: <1291821030.7243.230.camel@clint-MacBookPro> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] RE : Re: [PHP-DEV] [PATCH] Add option to disable POST data processing From: clint@ubuntu.com (Clint Byrum) On Wed, 2010-12-08 at 01:11 +0000, Gustavo Lopes wrote: > On Wed, 08 Dec 2010 00:45:56 -0000, Tjerk Meesters > 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.