diff options
Diffstat (limited to 'ext')
-rw-r--r-- | ext/standard/head.c | 4 | ||||
-rw-r--r-- | ext/zlib/php_zlib.h | 1 | ||||
-rw-r--r-- | ext/zlib/zlib.c | 18 |
3 files changed, 20 insertions, 3 deletions
diff --git a/ext/standard/head.c b/ext/standard/head.c index 9279bf2b01..10d33728f4 100644 --- a/ext/standard/head.c +++ b/ext/standard/head.c @@ -126,9 +126,7 @@ PHPAPI int php_setcookie(char *name, int name_len, char *value, int value_len, t ctr.line_len = strlen(cookie); result = sapi_header_op(SAPI_HEADER_ADD, &ctr TSRMLS_CC); - if (result == FAILURE) { - efree(cookie); - } + efree(cookie); return result; } diff --git a/ext/zlib/php_zlib.h b/ext/zlib/php_zlib.h index ce57652a46..5366337986 100644 --- a/ext/zlib/php_zlib.h +++ b/ext/zlib/php_zlib.h @@ -33,6 +33,7 @@ ZEND_BEGIN_MODULE_GLOBALS(zlib) int ob_gzip_coding; int output_compression; int output_compression_level; + char *output_handler; ZEND_END_MODULE_GLOBALS(zlib) extern zend_module_entry php_zlib_module_entry; diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index 3848b25186..10ef6aa273 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -177,10 +177,25 @@ static PHP_INI_MH(OnUpdate_zlib_output_compression_level) } /* }}} */ +/* {{{ OnUpdate_zlib_output_handler */ +static PHP_INI_MH(OnUpdate_zlib_output_handler) +{ + if (stage == PHP_INI_STAGE_RUNTIME && SG(headers_sent) && !SG(request_info).no_headers) { + php_error(E_WARNING, "Cannot change zlib.output_handler - headers already sent"); + return FAILURE; + } + + OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); + + return SUCCESS; +} +/* }}} */ + 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_ENTRY("zlib.output_compression_level", "-1", PHP_INI_ALL, OnUpdate_zlib_output_compression_level, 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() #ifdef ZTS @@ -1000,6 +1015,9 @@ int php_enable_output_compression(int buffer_size TSRMLS_DC) php_start_ob_buffer(NULL, buffer_size, 0 TSRMLS_CC); php_ob_set_internal_handler(php_gzip_output_handler, buffer_size*1.5, "zlib output compression", 0 TSRMLS_CC); + if (ZLIBG(output_handler) && strlen(ZLIBG(output_handler))) { + php_start_ob_buffer_named(ZLIBG(output_handler), 0, 1 TSRMLS_CC); + } return SUCCESS; } /* }}} */ |