Re: cvs: php4 /ext/zlib zlib.c /main output.c

From: Date: Mon, 30 Sep 2002 14:55:06 +0000
Subject: Re: cvs: php4 /ext/zlib zlib.c /main output.c
References: 1 2  Groups: php.dev 
Request: Send a blank email to php-dev+get-88782@lists.php.net to get a copy of this message
Zeev Suraski wrote:
Yasuo - this used to work in PHP 4.2 - setting zlib.output_compression = 1 should enable the default size of 4096 bytes... Did you do something that could have broken it?
That's what I thought, too. 1 enable buffer with default chunk size. IIRC, anything less than certain size is initialized with default or minimum chunk size, isn't it? At least, it was something like that. I don't think I change/broke it, since I didn't see any problem in it. Most of my changes are in 4.2.0, not in 4.3.0-dev. Marcus, how about you? I remember you have been changing chunk size, etc, recently. -- Yasuo Ohgaki
Zeev At 13:18 30/09/2002, Wez Furlong wrote:
wez             Mon Sep 30 06:18:06 2002 EDT
Modified files:
    /php4/ext/zlib      zlib.c
    /php4/main  output.c
Log: Fix infinite recursion bug when using zlib output compression. Cause: the chunk size is taken from the zlib.output_compression setting, which is 0 or 1. This causes the block_size for output buffer to be set to 0 (1 / 2) and thus causes infinite recursion in php_ob_allocate(). Solution: use a value of 0 for the chunk size which will use the default sizes. Also add a sanity check which will default the block_size to 1 if it ends up as 0. Index: php4/ext/zlib/zlib.c diff -u php4/ext/zlib/zlib.c:1.149 php4/ext/zlib/zlib.c:1.150 --- php4/ext/zlib/zlib.c:1.149 Tue Sep 3 18:54:02 2002
+++ php4/ext/zlib/zlib.c        Mon Sep 30 06:18:06 2002
@@ -18,7 +18,7 @@
    |          Jade Nicoletti <nicoletti@nns.ch>                           |
    +----------------------------------------------------------------------+
*/ -/* $Id: zlib.c,v 1.149 2002/09/03 22:54:02 sniper Exp $ */ +/* $Id: zlib.c,v 1.150 2002/09/30 10:18:06 wez Exp $ */ #define IS_EXT_MODULE #ifdef HAVE_CONFIG_H @@ -230,6 +230,8 @@
        ZLIBG(ob_gzhandler_status) = 0;
        ZLIBG(ob_gzip_coding) = 0;
        if (chunk_size) {
+               if (chunk_size == 1)
+                       chunk_size = 0; /* use the default size */
                php_enable_output_compression(chunk_size TSRMLS_CC);
        }
        return SUCCESS;
Index: php4/main/output.c diff -u php4/main/output.c:1.121 php4/main/output.c:1.122
--- php4/main/output.c:1.121    Mon Sep 23 10:18:42 2002
+++ php4/main/output.c Mon Sep 30 06:18:06 2002 @@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
*/ -/* $Id: output.c,v 1.121 2002/09/23 14:18:42 zeev Exp $ */ +/* $Id: output.c,v 1.122 2002/09/30 10:18:06 wez Exp $ */ #include "php.h" #include "ext/standard/head.h" @@ -132,6 +132,8 @@
        if (chunk_size) {
                initial_size = (chunk_size*3/2);
                block_size = chunk_size/2;
+               if (block_size == 0)
+                       block_size = 1;
        } else {
                initial_size = 40*1024;
                block_size = 10*1024;
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.dev (#88782) next »