@@ -263,6 +263,8 @@ static php_output_handler *php_zlib_output_handler_init(const char *handler_name
263
263
ZLIBG (output_compression ) = chunk_size ? chunk_size : PHP_OUTPUT_HANDLER_DEFAULT_SIZE ;
264
264
}
265
265
266
+ ZLIBG (handler_registered ) = 1 ;
267
+
266
268
if ((h = php_output_handler_create_internal (handler_name , handler_name_len , php_zlib_output_handler , chunk_size , flags TSRMLS_CC ))) {
267
269
php_output_handler_set_context (h , php_zlib_output_handler_context_init (TSRMLS_C ), php_zlib_output_handler_context_dtor TSRMLS_CC );
268
270
}
@@ -964,9 +966,10 @@ static PHP_MSHUTDOWN_FUNCTION(zlib)
964
966
static PHP_RINIT_FUNCTION (zlib )
965
967
{
966
968
ZLIBG (compression_coding ) = 0 ;
967
- ZLIBG (output_compression ) = ZLIBG (output_compression_default );
968
-
969
- php_zlib_output_compression_start (TSRMLS_C );
969
+ if (!ZLIBG (handler_registered )) {
970
+ ZLIBG (output_compression ) = ZLIBG (output_compression_default );
971
+ php_zlib_output_compression_start (TSRMLS_C );
972
+ }
970
973
971
974
return SUCCESS ;
972
975
}
@@ -976,6 +979,7 @@ static PHP_RINIT_FUNCTION(zlib)
976
979
static PHP_RSHUTDOWN_FUNCTION (zlib )
977
980
{
978
981
php_zlib_cleanup_ob_gzhandler_mess (TSRMLS_C );
982
+ ZLIBG (handler_registered ) = 0 ;
979
983
980
984
return SUCCESS ;
981
985
}
@@ -1000,6 +1004,7 @@ static PHP_MINFO_FUNCTION(zlib)
1000
1004
static ZEND_MODULE_GLOBALS_CTOR_D (zlib )
1001
1005
{
1002
1006
zlib_globals -> ob_gzhandler = NULL ;
1007
+ zlib_globals -> handler_registered = 0 ;
1003
1008
}
1004
1009
/* }}} */
1005
1010
0 commit comments