From a6f1533789b897d3b8930b437164e81e0a0f4c72 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Sat, 21 Jul 2012 02:56:28 +0800 Subject: [PATCH] Fixed bug #55544 (ob_gzhandler always conflicts with zlib.output_compression) --- NEWS | 4 ++++ ext/zlib/php_zlib.h | 1 + ext/zlib/zlib.c | 4 +++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 34b48d9c1e2..9cd089c1bf0 100644 --- a/NEWS +++ b/NEWS @@ -39,6 +39,10 @@ PHP NEWS . Fixed bug #62597 (segfault in php_stream_wrapper_log_error with ZTS build). (Laruence) +- Zlib: + . Fixed bug #55544 (ob_gzhandler always conflicts with + zlib.output_compression). (Laruence) + ?? ??? 2012, PHP 5.4.5 - Core: diff --git a/ext/zlib/php_zlib.h b/ext/zlib/php_zlib.h index 3d8c90cbf50..449dfed0620 100644 --- a/ext/zlib/php_zlib.h +++ b/ext/zlib/php_zlib.h @@ -52,6 +52,7 @@ ZEND_BEGIN_MODULE_GLOBALS(zlib) int compression_coding; long output_compression; long output_compression_level; + long output_compression_default; char *output_handler; php_zlib_context *ob_gzhandler; ZEND_END_MODULE_GLOBALS(zlib); diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index c6e2e0cf8bf..9cd1f378862 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -890,6 +890,7 @@ static PHP_INI_MH(OnUpdate_zlib_output_compression) status = OnUpdateLong(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); + ZLIBG(output_compression) = ZLIBG(output_compression_default); if (stage == PHP_INI_STAGE_RUNTIME && int_value) { if (!php_output_handler_started(ZEND_STRL(PHP_ZLIB_OUTPUT_HANDLER_NAME) TSRMLS_CC)) { php_zlib_output_compression_start(TSRMLS_C); @@ -914,7 +915,7 @@ static PHP_INI_MH(OnUpdate_zlib_output_handler) /* {{{ INI */ PHP_INI_BEGIN() - STD_PHP_INI_BOOLEAN("zlib.output_compression", "0", PHP_INI_ALL, OnUpdate_zlib_output_compression, output_compression, zend_zlib_globals, zlib_globals) + STD_PHP_INI_BOOLEAN("zlib.output_compression", "0", PHP_INI_ALL, OnUpdate_zlib_output_compression, output_compression_default, zend_zlib_globals, zlib_globals) STD_PHP_INI_ENTRY("zlib.output_compression_level", "-1", PHP_INI_ALL, OnUpdateLong, output_compression_level, zend_zlib_globals, zlib_globals) STD_PHP_INI_ENTRY("zlib.output_handler", "", PHP_INI_ALL, OnUpdate_zlib_output_handler, output_handler, zend_zlib_globals, zlib_globals) PHP_INI_END() @@ -958,6 +959,7 @@ static PHP_MSHUTDOWN_FUNCTION(zlib) static PHP_RINIT_FUNCTION(zlib) { ZLIBG(compression_coding) = 0; + ZLIBG(output_compression) = ZLIBG(output_compression_default); php_zlib_output_compression_start(TSRMLS_C);