Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:33480 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 73976 invoked by uid 1010); 28 Nov 2007 00:00:47 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 73961 invoked from network); 28 Nov 2007 00:00:46 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Nov 2007 00:00:46 -0000 Authentication-Results: pb1.pair.com smtp.mail=hannes.magnusson@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=hannes.magnusson@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 64.233.170.185 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: hannes.magnusson@gmail.com X-Host-Fingerprint: 64.233.170.185 rn-out-0910.google.com Linux 2.4/2.6 Received: from [64.233.170.185] ([64.233.170.185:50276] helo=rn-out-0102.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B3/77-25304-0AFAC474 for ; Tue, 27 Nov 2007 19:00:41 -0500 Received: by rn-out-0102.google.com with SMTP id s28so825430rnb for ; Tue, 27 Nov 2007 16:00:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=3SUMxTDSXpXiwVGLy87QlG4sDqAl6KqkT8iBB3Sp3y8=; b=wDxY82/vjyTMX4KpqsVJIyob83g46lsKIg78EAwZxfa4IBS0/gkXkypK5f5cgg3CQUnL59kBhnL97H3D4x2nlJYNVoQScswd0zcv4K6wgp5xuRyly4MwoAG4mDGL9WSbdaovLTEcxDQyh9qPBDjlrunNiVBbn2fcvLab5RqIe8c= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=QQ2eOPjQUg5Vim7wIFDgSBCG5RKDJdr+X73unXvPLe6WQfI2ajdybFrH6qP44SyQ8mRvbSQv7+bqz5qtEnh2ydKYawH+mNQU2vnMk6bgGbBRVuIcre5ALECLJ9Yc3Ukg6rtTLgthzDGeDzahdK4PgLtDgTlvuBTBJauy+LfB0bI= Received: by 10.143.162.8 with SMTP id p8mr1300498wfo.1196208002040; Tue, 27 Nov 2007 16:00:02 -0800 (PST) Received: by 10.142.170.21 with HTTP; Tue, 27 Nov 2007 16:00:01 -0800 (PST) Message-ID: <7f3ed2c30711271600w4b3c20ax14238f94d7df872d@mail.gmail.com> Date: Wed, 28 Nov 2007 01:00:02 +0100 To: enugroho@spikesource.com Cc: "PHP Developers Mailing List" In-Reply-To: <1196206722.31863.16.camel@ganges.spikesource.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <1196124442.21880.15.camel@ganges.spikesource.com> <474BA22F.2020608@lerdorf.com> <1196206722.31863.16.camel@ganges.spikesource.com> Subject: Re: [PHP-DEV] Reliable header sending mechanism in php 6 From: hannes.magnusson@gmail.com ("Hannes Magnusson") On Nov 28, 2007 12:38 AM, Ezra Nugroho wrote: > > On Tue, 2007-11-27 at 14:50 +1000, Rasmus Lerdorf wrote: > > Ezra Nugroho wrote: > > > Can I ask for the following support, at least to begin conversation > > > about it if it hasn't been done before. > > > > > > Currently, the header() function still carries the following warning in > > > its online documentation: > > > > > > "Remember that header() must be called before any actual output is sent, > > > either by normal HTML tags, blank lines in a file, or from PHP. It is a > > > very common error to read code with include(), or require(), functions, > > > or another file access function, and have spaces or empty lines that are > > > output before header() is called. The same problem exists when using a > > > single PHP/HTML file." > > > > > > This is quite annoying since this makes header() or setcookie() calls to > > > be unreliable. > > > > > > I am aware that it can be done more reliably by turning the output > > > buffering on. This is less of an issue if you are writing your own > > > webapp. However, this is much more difficult if a person writes a > > > library for other people's consumptions. The library cannot enforce > > > output buffering in the webapp. > > > > > > Can we please give it a thought in PHP 6? Maybe by turning output > > > buffering on by default, or even by enforcing output buffering. > > > > > > In Java, you can get the request object, and the response object of a > > > web request. I find this very useful and reliable. > > > > > > Any thoughts or comments about this? > > > > There is nothing unreliable about is as far as I am concerned. You have > > full control over output buffering from your script. Forcing people to > > buffer output by default will mean higher memory usage and higher > > latency for existing scripts with no gain given their code is working today. > > > In my mind, it is still unreliable... > When I write my library, how can I enforce people who adopt it to enable > ob? > > Furthermore, I think it's quite annoying that some functions may not > work just because of an inclusion of a blank space somewhere in a file > that you don't maintain. > > As php applications get bigger, and developers have only a small scope > of the big picture, the reliability of the functions becomes bigger and > bigger deal. http://docs.php.net/manual/en/outcontrol.configuration.php -Hannes