Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.1.4

Request #3960 Allow zlib.output_compression in php.ini
Submitted: 2005-03-25 16:07 UTC
From: brian at onlineinfo dot net Assigned: mike
Status: Closed Package: HTTP_Download
PHP Version: 4.3.10 OS:
Roadmaps: (Not assigned)    
Subscription  


 [2005-03-25 16:07 UTC] brian at onlineinfo dot net
Description: ------------ I was using HTTP_Download 0.5.1 and it was working fine with zlib.output_compression set in php.ini. After upgrade to 1.0.0 scripts get stuck in an endless loop because of the following condition: set_time_limit(0) is called and ob_get_level() seems to always returns 1 with zlib.output_compression enabled. It would be very nice to be able to use the latest-and-greatest version without having to modify the server configuration. Reproduce code: --------------- Here is a patch that is makes it work. I have tested this patch with Firefox/linux, Konqueror/linux, and Internet Explorer 6/windows 2000. --- /usr/local/lib/php/HTTP/Download.php 2005-03-25 09:55:28.000000000 -0500 +++ pear/HTTP/Download.php 2005-03-25 10:49:32.000000000 -0500 @@ -651,9 +651,7 @@ unset($this->headers['Last-Modified']); } - while (ob_get_level()) { - ob_end_clean(); - } + while (@ob_end_clean()); if ($this->gzip) { @ob_start('ob_gzhandler'); @@ -668,7 +666,12 @@ $this->HTTP->sendStatusCode(200); $chunks = array(array(0, $this->size)); if (!$this->gzip) { - $this->headers['Content-Length'] = $this->size; + // if only using default output handler set the + // Content-Length header. Otherwise assume the + // output handler will set the Content-Length header + if (!array_key_exists(1, ob_list_handlers())) { + $this->headers['Content-Length'] = $this->size; + } } }

Comments

 [2005-03-30 18:03 UTC] mike
This bug has been fixed in CVS. In case this was a documentation problem, the fix will show up at the end of next Sunday (CET) on pear.php.net. In case this was a pear.php.net website problem, the change will show up on the website in short time. Thank you for the report, and for helping us make PEAR better.