Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:64052 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 41857 invoked from network); 26 Nov 2012 14:44:56 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Nov 2012 14:44:56 -0000 Authentication-Results: pb1.pair.com smtp.mail=langemeijer@php.net; spf=unknown; sender-id=unknown Authentication-Results: pb1.pair.com header.from=langemeijer@php.net; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 213.193.247.34 as permitted sender) X-PHP-List-Original-Sender: langemeijer@php.net X-Host-Fingerprint: 213.193.247.34 mail01.procurios.net Linux 2.6 Received: from [213.193.247.34] ([213.193.247.34:50161] helo=mail01.procurios.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C4/56-26957-66083B05 for ; Mon, 26 Nov 2012 09:44:56 -0500 Received: from [172.24.1.65] (unknown [188.202.125.121]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: casper.casper) by mail01.procurios.net (Postfix) with ESMTPSA id B03D913982B1; Mon, 26 Nov 2012 15:44:51 +0100 (CET) Message-ID: <50B380AC.9000901@php.net> Date: Mon, 26 Nov 2012 15:46:04 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.10) Gecko/20121027 Icedove/10.0.10 MIME-Version: 1.0 To: Michael Wallner , internals@lists.php.net References: <50B1F9D7.80000@php.net> In-Reply-To: Content-Type: multipart/alternative; boundary="------------000108050002010206020400" Subject: Re: Bug 61272 From: langemeijer@php.net (Casper Langemeijer) --------------000108050002010206020400 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 11/26/2012 10:19 AM, Michael Wallner wrote: > I'm sorry that the new output control layer causes you such headaches. > IIRC, 6 years back, when I implemented the new output control > functionality, I kindly asked the list, whether to rather implement > what's documented, or what the old code did, but I have yet been > unable to find according mails. And now this code hits production for the first time I assume, if this is the only issue I think you have done a fab job! > It pretty well may have been the case that the old code passed the > output buffer contents through the handler prior discarding, but as it had > not been documented (and I obviously failed to figure out a use case) I > apparently implemented the more efficient way it currently is. Hmm.. I suppose It's up to me to make a strong (if possible watertight) plea for the old way. I will try: 1. I don't think my patch impacts the efficiency of php_output_clean(). It adds a single if with a binary compare. True: this causes output to get piped through the output handler, but the output handler callback function could be smart enough to back off when the PHP_OUTPUT_HANDLER_CLEAN bit is set in the second parameter of the callback. 2. Current behaviour is *not* according the documentation. ob_start() documentation states: " An optional output_callback function may be specified. This function takes a string as a parameter and should return a string. The function will be called when the output buffer is flushed (sent) or **cleaned** (with ob_flush(), ob_clean() or similar function) or when the output buffer is flushed to the browser at the end of the request. When output_callback is called, it will receive the contents of the output buffer as its parameter and is expected to return a new output buffer as a result, which will be sent to the browser." (*-emphasis mine) Current behaviour differs: On calling ob_end_clean() or ob_clean(), output_callback is called, but *without* the contents of the output buffer as its parameter. 3. Implementing my patch will never break anything. The output will be passed to the callback, but anything returned by it *will* be discarded. 4. If you are not going to pass the contents of the output buffer on ob_end_clean() or ob_clean() to the callback function, Why would you call the callback anyway? You may think this is a weird feature, this is how we use it: In output_callback we assign the output we catch with output buffering to a string variable, and we use that later on in the request to build our output. Greetings, Casper --------------000108050002010206020400--