mike Mon Sep 4 10:31:12 2006 UTC Added files: /php-src/ext/zlib/tests ob_004.phpt ob_005.phpt
Modified files: /php-src/ext/zlib zlib.c Log: - fix issues with ob_start("ob_gzhandler") - add tests http://cvs.php.net/viewvc.cgi/php-src/ext/zlib/zlib.c?r1=1.209&r2=1.210&diff_format=u Index: php-src/ext/zlib/zlib.c diff -u php-src/ext/zlib/zlib.c:1.209 php-src/ext/zlib/zlib.c:1.210 --- php-src/ext/zlib/zlib.c:1.209 Thu Aug 31 13:51:35 2006 +++ php-src/ext/zlib/zlib.c Mon Sep 4 10:31:11 2006 @@ -20,7 +20,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zlib.c,v 1.209 2006/08/31 13:51:35 mike Exp $ */ +/* $Id: zlib.c,v 1.210 2006/09/04 10:31:11 mike Exp $ */ #ifdef HAVE_CONFIG_H # include "config.h" @@ -105,10 +105,11 @@ { php_output_handler *h = NULL; - if (php_zlib_output_encoding(TSRMLS_C)) { - if ((h = php_output_handler_create_internal(handler_name, php_zlib_output_handler, chunk_size, flags TSRMLS_CC))) { - php_output_handler_set_context(h, ecalloc(1, sizeof(php_zlib_context)), php_zlib_output_handler_dtor TSRMLS_CC); - } + if (!ZLIBG(output_compression)) { + ZLIBG(output_compression) = chunk_size ? chunk_size : PHP_OUTPUT_HANDLER_DEFAULT_SIZE; + } + if ((h = php_output_handler_create_internal(handler_name, php_zlib_output_handler, chunk_size, flags TSRMLS_CC))) { + php_output_handler_set_context(h, ecalloc(1, sizeof(php_zlib_context)), php_zlib_output_handler_dtor TSRMLS_CC); } return h; @@ -119,7 +120,7 @@ int php_zlib_output_handler(void **handler_context, php_output_context *output_context) { php_zlib_context *ctx = *(php_zlib_context **) handler_context; - int flags = Z_SYNC_FLUSH, status; + int flags = Z_SYNC_FLUSH; PHP_OUTPUT_TSRMLS(output_context); if (!php_zlib_output_encoding(TSRMLS_C)) { @@ -180,7 +181,7 @@ flags = Z_FULL_FLUSH; } - switch ((status = deflate(&ctx->Z, flags))) { + switch (deflate(&ctx->Z, flags)) { case Z_OK: if (flags == Z_FINISH) { deflateEnd(&ctx->Z); @@ -629,7 +630,7 @@ { int status, int_value; char *ini_value; - + if (new_value == NULL) { return FAILURE; } http://cvs.php.net/viewvc.cgi/php-src/ext/zlib/tests/ob_004.phpt?view=markup&rev=1.1 Index: php-src/ext/zlib/tests/ob_004.phpt +++ php-src/ext/zlib/tests/ob_004.phpt --TEST-- ob_gzhandler --SKIPIF-- <?php if (!extension_loaded("zlib")) die("skip need ext/zlib"); if (false === stristr(PHP_SAPI, "cgi")) die("skip need sapi/cgi"); ?> --INI-- zlib.output_compression=0 --ENV-- HTTP_ACCEPT_ENCODING=gzip --FILE-- <?php ob_start("ob_gzhandler"); echo "hi\n"; ?> --EXPECTF-- %s Content-Encoding: gzip Vary: Accept-Encoding %s %s http://cvs.php.net/viewvc.cgi/php-src/ext/zlib/tests/ob_005.phpt?view=markup&rev=1.1 Index: php-src/ext/zlib/tests/ob_005.phpt +++ php-src/ext/zlib/tests/ob_005.phpt --TEST-- ob_gzhandler --SKIPIF-- <?php if (!extension_loaded("zlib")) die("skip need ext/zlib"); if (false === stristr(PHP_SAPI, "cgi")) die("skip need sapi/cgi"); ?> --INI-- zlib.output_compression=0 --ENV-- HTTP_ACCEPT_ENCODING=gzip --FILE-- <?php ob_start("ob_gzhandler"); ini_set("zlib.output_compression", 0); echo "hi\n"; ?> --EXPECTF-- %shi -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php