Skip to content

Commit 4235583

Browse files
author
Yasuo Ohgaki
committed
Changed my mind.
Let users decided whether users want larger chunk size or not. @ Changed zlib.output_compression behavior. If larger chunk is preferred, enable output_buffering also. (Marcus, Yasuo)
1 parent 02ed705 commit 4235583

File tree

3 files changed

+20
-18
lines changed

3 files changed

+20
-18
lines changed

ext/zlib/zlib.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,8 +1013,6 @@ int php_enable_output_compression(int buffer_size TSRMLS_DC)
10131013
return FAILURE;
10141014
}
10151015

1016-
if (OG(ob_nesting_level)==0)
1017-
php_start_ob_buffer(NULL, buffer_size, 0 TSRMLS_CC);
10181016
php_ob_set_internal_handler(php_gzip_output_handler, (uint)(buffer_size*3/2), "zlib output compression", 0 TSRMLS_CC);
10191017
if (ZLIBG(output_handler) && strlen(ZLIBG(output_handler))) {
10201018
php_start_ob_buffer_named(ZLIBG(output_handler), 0, 1 TSRMLS_CC);

php.ini-dist

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,21 +92,23 @@ output_buffering = Off
9292
; example, if you set output_handler to "mb_output_handler", character
9393
; encoding will be transparently converted to the specified encoding.
9494
; Setting any output handler automatically turns on output buffering.
95-
; NOTE: People who wrote portable scripts should not depend on this ini
96-
; directive. Instead, explicitly set the output handler using ob_start().
97-
; Using this ini directive may cause problems unless you know what script
98-
: is doing.
99-
; NOTE: You cannot use both "mb_output_handler" with "ob_inconv_handler"
100-
; and you cannot use both "ob_gzhandler" and "zlib.output_compression".
95+
; Note: People who wrote portable scripts should not depend on this ini
96+
; directive. Instead, explicitly set the output handler using ob_start().
97+
; Using this ini directive may cause problems unless you know what script
98+
: is doing.
99+
; Note: You cannot use both "mb_output_handler" with "ob_inconv_handler"
100+
; and you cannot use both "ob_gzhandler" and "zlib.output_compression".
101101
;output_handler =
102102

103103
; Transparent output compression using the zlib library
104104
; Valid values for this option are 'off', 'on', or a specific buffer size
105105
; to be used for compression (default is 4KB)
106-
;
106+
; Note: Resulting chunk size may vary due to nature of compression. PHP
107+
; outputs chunks that are few handreds bytes each as a result of compression.
108+
; If you want larger chunk size for better performence, enable output_buffering
109+
; also.
107110
; Note: output_handler must be empty if this is set 'On' !!!!
108111
; Instead you must use zlib.output_handler.
109-
;
110112
zlib.output_compression = Off
111113

112114
; You cannot specify additional output handlers if zlib.output_compression

php.ini-recommended

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,21 +105,23 @@ output_buffering = 4096
105105
; example, if you set output_handler to "mb_output_handler", character
106106
; encoding will be transparently converted to the specified encoding.
107107
; Setting any output handler automatically turns on output buffering.
108-
; NOTE: People who wrote portable scripts should not depend on this ini
109-
; directive. Instead, explicitly set the output handler using ob_start().
110-
; Using this ini directive may cause problems unless you know what script
111-
: is doing.
112-
; NOTE: You cannot use both "mb_output_handler" with "ob_inconv_handler"
113-
; and you cannot use both "ob_gzhandler" and "zlib.output_compression".
108+
; Note: People who wrote portable scripts should not depend on this ini
109+
; directive. Instead, explicitly set the output handler using ob_start().
110+
; Using this ini directive may cause problems unless you know what script
111+
: is doing.
112+
; Note: You cannot use both "mb_output_handler" with "ob_inconv_handler"
113+
; and you cannot use both "ob_gzhandler" and "zlib.output_compression".
114114
;output_handler =
115115

116116
; Transparent output compression using the zlib library
117117
; Valid values for this option are 'off', 'on', or a specific buffer size
118118
; to be used for compression (default is 4KB)
119-
;
119+
; Note: Resulting chunk size may vary due to nature of compression. PHP
120+
; outputs chunks that are few handreds bytes each as a result of compression.
121+
; If you want larger chunk size for better performence, enable output_buffering
122+
; also.
120123
; Note: output_handler must be empty if this is set 'On' !!!!
121124
; Instead you must use zlib.output_handler.
122-
;
123125
zlib.output_compression = Off
124126

125127
; You cannot specify additional output handlers if zlib.output_compression

0 commit comments

Comments
 (0)