Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:50915 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 36360 invoked from network); 8 Dec 2010 19:25:25 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Dec 2010 19:25:25 -0000 Authentication-Results: pb1.pair.com header.from=glopes@nebm.ist.utl.pt; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=glopes@nebm.ist.utl.pt; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain nebm.ist.utl.pt from 193.136.128.22 cause and error) X-PHP-List-Original-Sender: glopes@nebm.ist.utl.pt X-Host-Fingerprint: 193.136.128.22 smtp2.ist.utl.pt Linux 2.6 Received: from [193.136.128.22] ([193.136.128.22:52646] helo=smtp2.ist.utl.pt) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B3/A5-04432-2ABDFFC4 for ; Wed, 08 Dec 2010 14:25:24 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp2.ist.utl.pt (Postfix) with ESMTP id 0512A7000441; Wed, 8 Dec 2010 19:25:20 +0000 (WET) X-Virus-Scanned: by amavisd-new-2.6.4 (20090625) (Debian) at ist.utl.pt Received: from smtp2.ist.utl.pt ([127.0.0.1]) by localhost (smtp2.ist.utl.pt [127.0.0.1]) (amavisd-new, port 10025) with LMTP id ll0H0+f-sCiF; Wed, 8 Dec 2010 19:25:19 +0000 (WET) Received: from mail2.ist.utl.pt (mail.ist.utl.pt [IPv6:2001:690:2100:1::8]) by smtp2.ist.utl.pt (Postfix) with ESMTP id B4671700043D; Wed, 8 Dec 2010 19:25:19 +0000 (WET) Received: from cataphract-old (195.61.136.95.rev.vodafone.pt [95.136.61.195]) (Authenticated sender: ist155741) by mail2.ist.utl.pt (Postfix) with ESMTPSA id 982BE2001A31; Wed, 8 Dec 2010 19:25:19 +0000 (WET) Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes To: "Clint Byrum" Cc: internals@lists.php.net References: <1291821030.7243.230.camel@clint-MacBookPro> <1291835588.7243.273.camel@clint-MacBookPro> Date: Wed, 08 Dec 2010 19:25:02 -0000 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Organization: =?utf-8?Q?N=C3=BAcleo_de_Eng=2E_Biom=C3=A9di?= =?utf-8?Q?ca_do_IST?= Message-ID: In-Reply-To: <1291835588.7243.273.camel@clint-MacBookPro> User-Agent: Opera Mail/11.00 (Win32) Subject: Re: [PHP-DEV] [PATCH] Add option to disable POST data processing From: glopes@nebm.ist.utl.pt ("Gustavo Lopes") On Wed, 08 Dec 2010 19:13:08 -0000, Clint Byrum wrote: > On Wed, 2010-12-08 at 18:49 +0000, Gustavo Lopes wrote: >> On Wed, 08 Dec 2010 15:10:30 -0000, Clint Byrum >> wrote: >> >>> >>> 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. >>> >> >> I'm sorry, this doesn't make any sense. "The memory location you read >> into"? Who says you read the post data *into* something, much less a >> memory location? >> > > Sorry, to be more clear: > > A lazy load on access to $_POST or $HTTP_RAW_POST_DATA would have to > read the POST data from the SAPI. At that point, the SAPI can keep the > buffer it allocates to read that data as a memory stream, and change its > notion of php://input to refer to that stream. What would be possible would be to consume all the data from a SAPI (typically indirectly from a socket, e.g. an Apache brigade), store it memory and make php://input read from there (i.e., the current behavior) but in a lazy manner when $_POST and $HTTP_RAW_POST_DATA are read. However, this wouldn't solve the problem this option tries to resolve, i.e., avoid consuming the POST data into memory when all that's needed is a a stream-like access to that data (it also solves the problem the raw POST data is not available in multipart requests). It wouldn't be solved because you would have to copy all the data into memory to permit multiple reads from php://input (the example I gave) and to allow reading from $_POST and php://input in the same request (for example, if you access $_POST first, you have to consume the whole POST data to build the array; at this point you will have needed to store this data somewhere to make it available to a subsequent read from php://input). -- Gustavo Lopes