|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-08-24 21:05 UTC] xuefer at 21cn dot com
Description: ------------ fix to bugs@34191 broken 2 echos sapi: fastcgi zlib.output_compression = On turn off=no problem revert the fix=no problem too can llia please look into it? Reproduce code: --------------- <?php echo 1; echo 2; ?> Expected result: ---------------- 12 Actual result: -------------- empty page in browser (corrupted gzip data) PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 04:00:02 2025 UTC |
confirmed with ./configure --disable-all --disable-cli --with-zlib both with cgi and fastcgi good: HTTP_ACCEPT_ENCODING=gzip php-cgi test.php |md5sum 826a819e34f7d57597d890de4176c265 - bad: HTTP_ACCEPT_ENCODING=gzip php-cgi test.php |md5sum 2e7dc64cd654b82f712b47b790dcbc12 - (gdb) br 720 Breakpoint 2 at 0x805d6e5: file /home/xuefer/src/php4/ext/zlib/zlib.c, line 720. (gdb) r #0 php_do_deflate (str_length=2, p_buffer=0xbffff028, p_buffer_len=0xbffff02c, do_start=1 '\001', do_end=1 '\001') at /home/xuefer/src/php4/ext/zlib/zlib.c:720 (gdb) p outlen-zlib_globals.stream.avail_out $8 = 10 (gdb) p buffer[outlen-zlib_globals.stream.avail_out] $9 = 50 '2' (gdb) step 724 *p_buffer = buffer; (gdb) p buffer[outlen-zlib_globals.stream.avail_out] $10 = 0 '\0' the 2 is exactly what i see in httpwatch that get "lost" with the patch applied test result by php->lighttpd->httpwatch is at: ftp://211.92.88.40/pub/phpbug/test.php.response.txt ftp://211.92.88.40/pub/phpbug/test.php.response-corrupted.txti'd guess the "start_offset" is to avoid an extra erealloc. this bug should only happen when both do_start do_end is true (do_end=true && start_offset!=0) /* {{{ php_do_deflate @@ -717,7 +718,7 @@ if (do_end) { err = deflate(&ZLIBG(stream), Z_FINISH); - buffer[outlen - ZLIBG(stream).avail_out] = '\0'; + buffer[outlen + start_offset - ZLIBG(stream).avail_out] = '\0'; }