Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:56409 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 32611 invoked from network); 18 Nov 2011 19:11:21 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Nov 2011 19:11:21 -0000 X-Host-Fingerprint: 46.75.252.247 mk046075252247.a1.net Date: Fri, 18 Nov 2011 14:11:19 -0500 Received: from [46.75.252.247] ([46.75.252.247:29576] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 56/F5-06569-6DDA6CE4 for ; Fri, 18 Nov 2011 14:11:19 -0500 Message-ID: <56.F5.06569.6DDA6CE4@pb1.pair.com> To: internals@lists.php.net References: <4EC025B4.2070009@sugarcrm.com> <4EC17308.6030406@sugarcrm.com> User-Agent: Pan/0.135 (Tomorrow I'll Wake Up and Scald Myself with Tea; GIT 30dc37b master) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Posted-By: 46.75.252.247 Subject: Re: [PHP-DEV] function ob_gzhandler is missed in 5.4 From: mike@php.net (Michael Wallner) On Fri, 18 Nov 2011 12:46:05 +0100, Nicolas Grekas wrote: > Without a real ob_gzhandler function, replacing it with an alias as > currently in RC1 : what if someone then creates an ob_gzhandler function > in userland ? would ob_start('ob_gzhandler') use the userland function > or still the alias ? I think this is a second argument to make > ob_gzhandler a real function : least surprise. Why make others suffer, just if you want to? > > Personally, I do use ob_gzhandler directly because it's the easiest way > to do chunked compressed encoding in userland. > > This allows me to ask for compression as late as possible, because > registering an ob_start('ob_gzhandler'); may be too early for me. I do > want to choose to enable compression only when the very first byte is > about to be sent over the wire. > > Hope it helps > > Nicolas > > > function my_ob_handler($buffer, $mode) > { > // based on content-type, > // do some $buffer filtering // and add some header() > > if (/* content-type benefits compression based on some userland rules > */) { > $buffer = ob_gzhandler($buffer, $mode); // benefits from gzip > negotiation, chunked compression and related headers > > if (PHP_OUTPUT_HANDLER_START & $mode) > { > // play/fix with Vary: header, as sent by ob_gzhandler or before } > } > > return $buffer; > } Looks like a bad hack, but anyway, here's is another hack [1]. It's a patch for ext/zlib, which should make your hack work again... whoever might find worth the hassle, may commit it... or insist on me to do so... Regards, Mike [1] http://dev.iworks.at/PATCHES/ob_gzhandler.diff.txt