[PATCH] A fix for OnUpdate_zlib_output_compression
| From: | Moriyoshi Koizumi | Date: | Sun, 03 Nov 2002 20:21:29 +0000 |
| Subject: | [PATCH] A fix for OnUpdate_zlib_output_compression | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-90476@lists.php.net to get a copy of this message | ||
The attached patch is a fix for misbehaviour of
OnUpdate_zlib_output_compression. Without this patch, test cases always
fail complaining "Cannot use both zlib.output_compression and
output_handler together!!" when output_handler is used.
Any objections?
Moriyoshi
Index: zlib.c =================================================================== RCS file: /repository/php4/ext/zlib/zlib.c,v retrieving revision 1.152 diff -u -r1.152 zlib.c --- zlib.c 3 Oct 2002 03:58:12 -0000 1.152 +++ zlib.c 3 Nov 2002 20:09:39 -0000 @@ -135,13 +135,6 @@ { char *ini_value; - ini_value = zend_ini_string("output_handler", sizeof("output_handler"), 0); - if (ini_value != NULL && strlen(ini_value) != 0 && - new_value != NULL && strlen(new_value) != 0 ) { - php_error_docref("ref.outcontrol" TSRMLS_CC, E_CORE_ERROR, "Cannot use both zlib.output_compression and output_handler together!!"); - return FAILURE; - } - if(new_value == NULL) return FAILURE; @@ -151,6 +144,13 @@ } else if(!strncasecmp(new_value, "on", sizeof("on"))) { new_value = "1"; new_value_length = sizeof("1"); + } + + ini_value = zend_ini_string("output_handler", sizeof("output_handler"), 0); + if (ini_value != NULL && strlen(ini_value) != 0 && + zend_atoi(new_value, new_value_length) != 0) { + php_error_docref("ref.outcontrol" TSRMLS_CC, E_CORE_ERROR, "Cannot use both zlib.output_compression and output_handler together!!"); + return FAILURE; } if (stage == PHP_INI_STAGE_RUNTIME && SG(headers_sent) && !SG(request_info).no_headers) {
Index: zlib.c =================================================================== RCS file: /repository/php4/ext/zlib/zlib.c,v retrieving revision 1.152 diff -u -r1.152 zlib.c --- zlib.c 3 Oct 2002 03:58:12 -0000 1.152 +++ zlib.c 3 Nov 2002 20:09:39 -0000 @@ -135,13 +135,6 @@ { char *ini_value; - ini_value = zend_ini_string("output_handler", sizeof("output_handler"), 0); - if (ini_value != NULL && strlen(ini_value) != 0 && - new_value != NULL && strlen(new_value) != 0 ) { - php_error_docref("ref.outcontrol" TSRMLS_CC, E_CORE_ERROR, "Cannot use both zlib.output_compression and output_handler together!!"); - return FAILURE; - } - if(new_value == NULL) return FAILURE; @@ -151,6 +144,13 @@ } else if(!strncasecmp(new_value, "on", sizeof("on"))) { new_value = "1"; new_value_length = sizeof("1"); + } + + ini_value = zend_ini_string("output_handler", sizeof("output_handler"), 0); + if (ini_value != NULL && strlen(ini_value) != 0 && + zend_atoi(new_value, new_value_length) != 0) { + php_error_docref("ref.outcontrol" TSRMLS_CC, E_CORE_ERROR, "Cannot use both zlib.output_compression and output_handler together!!"); + return FAILURE; } if (stage == PHP_INI_STAGE_RUNTIME && SG(headers_sent) && !SG(request_info).no_headers) {