jani Tue May 26 05:57:40 2009 UTC Modified files: (Branch: PHP_5_2) /php-src NEWS /php-src/ext/zlib zlib.c Log: MF53: - Fixed bug #45202 (zlib.output_compression can not be set with ini_set() # This is fixed in HEAD already. :) http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1520&r2=1.2027.2.547.2.1521&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.1520 php-src/NEWS:1.2027.2.547.2.1521 --- php-src/NEWS:1.2027.2.547.2.1520 Tue May 26 04:47:04 2009 +++ php-src/NEWS Tue May 26 05:57:40 2009 @@ -113,6 +113,8 @@ - Fixed bug #45614 (ArrayIterator::current(), ::key() can show 1st private prop of wrapped object). (robin_fernandes at uk dot ibm dot com, Arnaud) - Fixed bug #45540 (stream_context_create creates bad http request). (Arnaud) +- Fixed bug #45202 (zlib.output_compression can not be set with ini_set()). + (Jani) - Fixed bug #45191 (error_log ignores date.timezone php.ini val when setting logging timestamps). (Derick) - Fixed bug #45092 (header HTTP context option not being used when compiled http://cvs.php.net/viewvc.cgi/php-src/ext/zlib/zlib.c?r1=1.183.2.6.2.11&r2=1.183.2.6.2.12&diff_format=u Index: php-src/ext/zlib/zlib.c diff -u php-src/ext/zlib/zlib.c:1.183.2.6.2.11 php-src/ext/zlib/zlib.c:1.183.2.6.2.12 --- php-src/ext/zlib/zlib.c:1.183.2.6.2.11 Tue May 26 04:47:05 2009 +++ php-src/ext/zlib/zlib.c Tue May 26 05:57:40 2009 @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zlib.c,v 1.183.2.6.2.11 2009/05/26 04:47:05 jani Exp $ */ +/* $Id: zlib.c,v 1.183.2.6.2.12 2009/05/26 05:57:40 jani Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -88,7 +88,7 @@ /* True globals, no need for thread safety */ static const int gz_magic[2] = {0x1f, 0x8b}; /* gzip magic header */ -static int php_enable_output_compression(int buffer_size TSRMLS_DC); +static int php_zlib_output_compression_start(TSRMLS_D); static PHP_MINIT_FUNCTION(zlib); static PHP_MSHUTDOWN_FUNCTION(zlib); @@ -176,6 +176,7 @@ /* {{{ OnUpdate_zlib_output_compression */ static PHP_INI_MH(OnUpdate_zlib_output_compression) { + int status, int_value; char *ini_value; if (new_value == NULL) { @@ -190,8 +191,10 @@ new_value_length = sizeof("1"); } + int_value = zend_atoi(new_value, new_value_length); 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) { + + if (ini_value && *ini_value && int_value) { php_error_docref("ref.outcontrol" TSRMLS_CC, E_CORE_ERROR, "Cannot use both zlib.output_compression and output_handler together!!"); return FAILURE; } @@ -201,9 +204,13 @@ return FAILURE; } - OnUpdateLong(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); + status = OnUpdateLong(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); - return SUCCESS; + if (stage == PHP_INI_STAGE_RUNTIME && int_value) { + status = php_zlib_output_compression_start(TSRMLS_C); + } + + return status; } /* }}} */ @@ -257,18 +264,10 @@ */ static PHP_RINIT_FUNCTION(zlib) { - uint chunk_size = ZLIBG(output_compression); - ZLIBG(ob_gzhandler_status) = 0; ZLIBG(compression_coding) = 0; - if (chunk_size) { - if (chunk_size == 1) { - chunk_size = 4096; /* use the default size */ - ZLIBG(output_compression) = chunk_size; - } - php_enable_output_compression(chunk_size TSRMLS_CC); - } - return SUCCESS; + + return php_zlib_output_compression_start(TSRMLS_C); } /* }}} */ @@ -1032,6 +1031,24 @@ } /* }}} */ +/* {{{ php_zlib_output_compression_start() */ +static int php_zlib_output_compression_start(TSRMLS_D) +{ + switch (ZLIBG(output_compression)) { + case 0: + break; + case 1: + ZLIBG(output_compression) = 4096; + default: + /* ZLIBG(compression_coding) should be 0 when zlib compression hasn't been started yet.. */ + if (ZLIBG(compression_coding) == 0) { + return php_enable_output_compression(ZLIBG(output_compression) TSRMLS_CC); + } + } + return SUCCESS; +} +/* }}} */ + /* * Local variables: * tab-width: 4
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php