PHP 4.0 Bug #7033 Updated: gzcompress does not work as expected

From: Date: Wed, 11 Oct 2000 13:37:04 +0000
Subject: PHP 4.0 Bug #7033 Updated: gzcompress does not work as expected
Groups: php.dev 
Request: Send a blank email to php-dev+get-34670@lists.php.net to get a copy of this message
ID: 7033 Updated by: stas Reported By: mg@plum.de Status: Analyzed Bug Type: Documentation problem Assigned To: Comments: See also #6481 Previous Comments: --------------------------------------------------------------------------- [2000-10-11 09:35:20] stas@php.net Yes, gzcompress and gzopen&friends are different function. The latter does not put gzip headers (whatever they are) to the output. You should use gzopen, etc. if you want to be gzip-compatible. That's how it is in zlib library. Since this about the third time people ask this, I move this to doc's problem. --------------------------------------------------------------------------- [2000-10-05 04:24:02] mg@plum.de $gzip = gzcompress($h->inhalt); header("Content-Encoding: gzip"); print($gzip); $fp = fopen("/tmp/file.gz","w"); fputs($fp,$gzip); fclose($fp); does not work, the browser does not display anything, and gzip -d /tmp/file.gz tells me that the file is not a valid gzip file. If I do: $fp = gzopen ("/tmp/file.gz", "w"); gzputs($fp,$h->inhalt); gzclose($fp); and then gzip -d again, everything works. The file generated by gzcompress is about 20 Bytes shorter than the one from gzopen, so I suspect there is probably some problem with NULL-Termination... TIA, Michael --------------------------------------------------------------------------- Full Bug description available at: http://bugs.php.net/?id=7033

« previous php.dev (#34670) next »