summaryrefslogtreecommitdiff
path: root/ext/zlib
diff options
context:
space:
mode:
authorWez Furlong <wez@php.net>2002-09-30 10:18:06 +0000
committerWez Furlong <wez@php.net>2002-09-30 10:18:06 +0000
commit4356932dfe142bcd4f8ede540c8a7415b175445d (patch)
treed08c4dca04a1bc2defe5efd48f260e608fcd3fce /ext/zlib
parent6e0c5d0fdc21ceba770791895e9aa813dfd30fb9 (diff)
downloadphp-git-4356932dfe142bcd4f8ede540c8a7415b175445d.tar.gz
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.
Diffstat (limited to 'ext/zlib')
-rw-r--r--ext/zlib/zlib.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c
index b6bf9e90ff..ffec5e8437 100644
--- a/ext/zlib/zlib.c
+++ b/ext/zlib/zlib.c
@@ -230,6 +230,8 @@ PHP_RINIT_FUNCTION(zlib)
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;