diff options
author | Xinchen Hui <laruence@php.net> | 2012-07-24 14:46:25 +0800 |
---|---|---|
committer | Xinchen Hui <laruence@php.net> | 2012-07-24 14:46:25 +0800 |
commit | dd9d64b21e4bbc8a106a6156dc6ffefbcc33ec02 (patch) | |
tree | cfc9137d90d6e7e050f39379cf2314fe52a982a4 /ext/zlib | |
parent | 6126ac44b5348dc7aac9d2c67f8e927211dfee2f (diff) | |
parent | 9fe8c58130ac82d2b52b35a290b71569abe50d18 (diff) | |
download | php-git-dd9d64b21e4bbc8a106a6156dc6ffefbcc33ec02.tar.gz |
Merge branch 'PHP-5.4'
Diffstat (limited to 'ext/zlib')
-rw-r--r-- | ext/zlib/php_zlib.h | 3 | ||||
-rw-r--r-- | ext/zlib/tests/bug55544.phpt | bin | 0 -> 361 bytes | |||
-rw-r--r-- | ext/zlib/zlib.c | 11 |
3 files changed, 10 insertions, 4 deletions
diff --git a/ext/zlib/php_zlib.h b/ext/zlib/php_zlib.h index 449dfed062..e895e0e482 100644 --- a/ext/zlib/php_zlib.h +++ b/ext/zlib/php_zlib.h @@ -52,9 +52,10 @@ 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; + long output_compression_default; + zend_bool handler_registered; ZEND_END_MODULE_GLOBALS(zlib); php_stream *php_stream_gzopen(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC); diff --git a/ext/zlib/tests/bug55544.phpt b/ext/zlib/tests/bug55544.phpt Binary files differnew file mode 100644 index 0000000000..ca4214a46f --- /dev/null +++ b/ext/zlib/tests/bug55544.phpt diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index eac757bbc5..7ff2b30c4c 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -263,6 +263,8 @@ static php_output_handler *php_zlib_output_handler_init(const char *handler_name ZLIBG(output_compression) = chunk_size ? chunk_size : PHP_OUTPUT_HANDLER_DEFAULT_SIZE; } + ZLIBG(handler_registered) = 1; + if ((h = php_output_handler_create_internal(handler_name, handler_name_len, php_zlib_output_handler, chunk_size, flags TSRMLS_CC))) { php_output_handler_set_context(h, php_zlib_output_handler_context_init(TSRMLS_C), php_zlib_output_handler_context_dtor TSRMLS_CC); } @@ -964,9 +966,10 @@ 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); + if (!ZLIBG(handler_registered)) { + ZLIBG(output_compression) = ZLIBG(output_compression_default); + php_zlib_output_compression_start(TSRMLS_C); + } return SUCCESS; } @@ -976,6 +979,7 @@ static PHP_RINIT_FUNCTION(zlib) static PHP_RSHUTDOWN_FUNCTION(zlib) { php_zlib_cleanup_ob_gzhandler_mess(TSRMLS_C); + ZLIBG(handler_registered) = 0; return SUCCESS; } @@ -1000,6 +1004,7 @@ static PHP_MINFO_FUNCTION(zlib) static ZEND_MODULE_GLOBALS_CTOR_D(zlib) { zlib_globals->ob_gzhandler = NULL; + zlib_globals->handler_registered = 0; } /* }}} */ |