[PHP-CVS] cvs: php-src /ext/zlib zlib.c
janiTue May 26 08:02:32 2009 UTC Modified files: /php-src/ext/zlib zlib.c Log: - Add note about missing break http://cvs.php.net/viewvc.cgi/php-src/ext/zlib/zlib.c?r1=1.225r2=1.226diff_format=u Index: php-src/ext/zlib/zlib.c diff -u php-src/ext/zlib/zlib.c:1.225 php-src/ext/zlib/zlib.c:1.226 --- php-src/ext/zlib/zlib.c:1.225 Tue Mar 10 23:39:52 2009 +++ php-src/ext/zlib/zlib.c Tue May 26 08:02:31 2009 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: zlib.c,v 1.225 2009/03/10 23:39:52 helly Exp $ */ +/* $Id: zlib.c,v 1.226 2009/05/26 08:02:31 jani Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -95,6 +95,7 @@ break; case 1: ZLIBG(output_compression) = PHP_OUTPUT_HANDLER_DEFAULT_SIZE; + /* break omitted intentionally */ default: MAKE_STD_ZVAL(tmp); ZVAL_ASCII_STRING(tmp, PHP_ZLIB_OUTPUT_HANDLER_NAME, ZSTR_DUPLICATE); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/zlib zlib.c
lbarnaudSat Aug 2 02:36:14 2008 UTC Modified files: /php-src/ext/zlib zlib.c Log: Avoid leaks when zlib streams can not be closed properly. http://cvs.php.net/viewvc.cgi/php-src/ext/zlib/zlib.c?r1=1.219r2=1.220diff_format=u Index: php-src/ext/zlib/zlib.c diff -u php-src/ext/zlib/zlib.c:1.219 php-src/ext/zlib/zlib.c:1.220 --- php-src/ext/zlib/zlib.c:1.219 Thu Jul 3 12:21:25 2008 +++ php-src/ext/zlib/zlib.c Sat Aug 2 02:36:14 2008 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: zlib.c,v 1.219 2008/07/03 12:21:25 felipe Exp $ */ +/* $Id: zlib.c,v 1.220 2008/08/02 02:36:14 lbarnaud Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -36,6 +36,19 @@ ZEND_DECLARE_MODULE_GLOBALS(zlib); +/* {{{ Memory management wrappers */ + +static voidpf php_zlib_alloc(voidpf opaque, uInt items, uInt size) +{ + return (voidpf)safe_emalloc(items, size, 0); +} + +static void php_zlib_free(voidpf opaque, voidpf address) +{ + efree((void*)address); +} +/* }}} */ + /* {{{ php_zlib_output_conflict_check() */ int php_zlib_output_conflict_check(zval *handler_name TSRMLS_DC) { @@ -104,12 +117,16 @@ php_output_handler *php_zlib_output_handler_init(zval *handler_name, size_t chunk_size, int flags TSRMLS_DC) { php_output_handler *h = NULL; + php_zlib_context *ctx; 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); + ctx = (php_zlib_context *) ecalloc(1, sizeof(php_zlib_context)); + ctx-Z.zalloc = php_zlib_alloc; + ctx-Z.zfree = php_zlib_free; + php_output_handler_set_context(h, ctx, php_zlib_output_handler_dtor TSRMLS_CC); } return h; @@ -264,6 +281,8 @@ z_stream Z; memset(Z, 0, sizeof(z_stream)); + Z.zalloc = php_zlib_alloc; + Z.zfree = php_zlib_free; if (Z_OK == (status = deflateInit2(Z, level, Z_DEFLATED, encoding, MAX_MEM_LEVEL, Z_DEFAULT_STRATEGY))) { *out_len = PHP_ZLIB_BUFFER_SIZE_GUESS(in_len); @@ -347,6 +366,9 @@ z_stream Z; memset(Z, 0, sizeof(z_stream)); + Z.zalloc = php_zlib_alloc; + Z.zfree = php_zlib_free; + if (in_len) { retry_raw_inflate: status = inflateInit2(Z, encoding); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/zlib zlib.c
mikeFri Feb 2 17:11:10 2007 UTC Modified files: /php-src/ext/zlib zlib.c Log: - add note about the past for the future, see http://bugs.php.net/?id=40310edit=1 http://cvs.php.net/viewvc.cgi/php-src/ext/zlib/zlib.c?r1=1.213r2=1.214diff_format=u Index: php-src/ext/zlib/zlib.c diff -u php-src/ext/zlib/zlib.c:1.213 php-src/ext/zlib/zlib.c:1.214 --- php-src/ext/zlib/zlib.c:1.213 Mon Jan 1 09:29:34 2007 +++ php-src/ext/zlib/zlib.c Fri Feb 2 17:11:10 2007 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: zlib.c,v 1.213 2007/01/01 09:29:34 sebastian Exp $ */ +/* $Id: zlib.c,v 1.214 2007/02/02 17:11:10 mike Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -218,6 +218,8 @@ deflateEnd(ctx-Z); return FAILURE; } + /* Vary: Accept-Encoding header sent along uncompressed content breaks caching in MSIE, + so let's just send it with successfully compressed content, see http://bugs.php.net/40325 */ sapi_add_header_ex(ZEND_STRL(Vary: Accept-Encoding), 1, 1 TSRMLS_CC); php_output_handler_hook(PHP_OUTPUT_HANDLER_HOOK_IMMUTABLE, NULL TSRMLS_CC); } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/zlib zlib.c
mikeThu Nov 16 13:36:03 2006 UTC Modified files: /php-src/ext/zlib zlib.c Log: - fix protos http://cvs.php.net/viewvc.cgi/php-src/ext/zlib/zlib.c?r1=1.211r2=1.212diff_format=u Index: php-src/ext/zlib/zlib.c diff -u php-src/ext/zlib/zlib.c:1.211 php-src/ext/zlib/zlib.c:1.212 --- php-src/ext/zlib/zlib.c:1.211 Tue Sep 19 10:38:31 2006 +++ php-src/ext/zlib/zlib.c Thu Nov 16 13:36:03 2006 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: zlib.c,v 1.211 2006/09/19 10:38:31 dmitry Exp $ */ +/* $Id: zlib.c,v 1.212 2006/11/16 13:36:03 mike Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -553,39 +553,39 @@ RETURN_STRINGL(out_buf, out_len, 0); \ } -/* {{{ proto string zlib_encode(string data, int encoding[, int level = -1]) U +/* {{{ proto binary zlib_encode(binary data, int encoding[, int level = -1]) U Compress data with the specified encoding */ PHP_ZLIB_ENCODE_FUNC(zlib_encode, 0); /* }}} */ -/* {{{ proto string zlib_decode(string data[, int max_decoded_len]) U +/* {{{ proto binary zlib_decode(binary data[, int max_decoded_len]) U Uncompress any raw/gzip/zlib encoded data */ PHP_ZLIB_DECODE_FUNC(zlib_decode, PHP_ZLIB_ENCODING_ANY); /* }}} */ /* NOTE: The naming of these userland functions was quite unlucky */ -/* {{{ proto string gzdeflate(string data[, int level = -1[, int encoding = ZLIB_ENCODING_RAW]) U +/* {{{ proto binary gzdeflate(binary data[, int level = -1[, int encoding = ZLIB_ENCODING_RAW]) U Encode data with the raw deflate encoding */ PHP_ZLIB_ENCODE_FUNC(gzdeflate, PHP_ZLIB_ENCODING_RAW); /* }}} */ -/* {{{ proto string gzencode(string data[, int level = -1[, int encoding = ZLIB_ENCODING_GZIP]) U +/* {{{ proto binary gzencode(binary data[, int level = -1[, int encoding = ZLIB_ENCODING_GZIP]) U Encode data with the gzip encoding */ PHP_ZLIB_ENCODE_FUNC(gzencode, PHP_ZLIB_ENCODING_GZIP); /* }}} */ -/* {{{ proto string gzcompress(string data[, int level = -1[, int encoding = ZLIB_ENCODING_DEFLATE]) U +/* {{{ proto binary gzcompress(binary data[, int level = -1[, int encoding = ZLIB_ENCODING_DEFLATE]) U Encode data with the zlib encoding */ PHP_ZLIB_ENCODE_FUNC(gzcompress, PHP_ZLIB_ENCODING_DEFLATE); /* }}} */ -/* {{{ proto string gzinflate(string data[, int max_decoded_len]) U +/* {{{ proto binary gzinflate(binary data[, int max_decoded_len]) U Decode raw deflate encoded data */ PHP_ZLIB_DECODE_FUNC(gzinflate, PHP_ZLIB_ENCODING_RAW); /* }}} */ -/* {{{ proto string gzdecode(string data[, int max_decoded_len]) U +/* {{{ proto binary gzdecode(binary data[, int max_decoded_len]) U Decode gzip encoded data */ PHP_ZLIB_DECODE_FUNC(gzdecode, PHP_ZLIB_ENCODING_GZIP); /* }}} */ -/* {{{ proto string gzuncompress(string data[, int max_decoded_len]) U +/* {{{ proto binary gzuncompress(binary data[, int max_decoded_len]) U Decode zlib encoded data */ PHP_ZLIB_DECODE_FUNC(gzuncompress, PHP_ZLIB_ENCODING_DEFLATE); /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/zlib zlib.c /ext/zlib/tests ob_004.phpt ob_005.phpt
mikeMon 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.209r2=1.210diff_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=markuprev=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=markuprev=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
[PHP-CVS] cvs: php-src /ext/zlib zlib.c
mikeWed Aug 30 12:07:04 2006 UTC Modified files: /php-src/ext/zlib zlib.c Log: - avoid a loop around deflate() by using Z_SYNC_FLUSH for standard write http://cvs.php.net/viewvc.cgi/php-src/ext/zlib/zlib.c?r1=1.205r2=1.206diff_format=u Index: php-src/ext/zlib/zlib.c diff -u php-src/ext/zlib/zlib.c:1.205 php-src/ext/zlib/zlib.c:1.206 --- php-src/ext/zlib/zlib.c:1.205 Wed Aug 30 07:42:02 2006 +++ php-src/ext/zlib/zlib.c Wed Aug 30 12:07:04 2006 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: zlib.c,v 1.205 2006/08/30 07:42:02 mike Exp $ */ +/* $Id: zlib.c,v 1.206 2006/08/30 12:07:04 mike Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -89,7 +89,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_NO_FLUSH, level; + int flags = Z_SYNC_FLUSH, status; PHP_OUTPUT_TSRMLS(output_context); if (!php_zlib_output_encoding(TSRMLS_C)) { @@ -147,10 +147,10 @@ if (output_context-op PHP_OUTPUT_HANDLER_FINAL) { flags = Z_FINISH; } else if (output_context-op PHP_OUTPUT_HANDLER_FLUSH) { - flags = Z_SYNC_FLUSH; + flags = Z_FULL_FLUSH; } - switch (deflate(ctx-Z, flags)) { + switch ((status = deflate(ctx-Z, flags))) { case Z_OK: if (flags == Z_FINISH) { deflateEnd(ctx-Z); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/zlib zlib.c
mikeWed Aug 30 14:42:26 2006 UTC Modified files: /php-src/ext/zlib zlib.c Log: - allow (de)activation with ini_set() http://cvs.php.net/viewvc.cgi/php-src/ext/zlib/zlib.c?r1=1.206r2=1.207diff_format=u Index: php-src/ext/zlib/zlib.c diff -u php-src/ext/zlib/zlib.c:1.206 php-src/ext/zlib/zlib.c:1.207 --- php-src/ext/zlib/zlib.c:1.206 Wed Aug 30 12:07:04 2006 +++ php-src/ext/zlib/zlib.c Wed Aug 30 14:42:26 2006 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: zlib.c,v 1.206 2006/08/30 12:07:04 mike Exp $ */ +/* $Id: zlib.c,v 1.207 2006/08/30 14:42:26 mike Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -70,6 +70,34 @@ } /* }}} */ +/* {{{ php_zlib_output_compression_start() */ +void php_zlib_output_compression_start(TSRMLS_D) +{ + zval *zoh, *tmp; + php_output_handler *h; + + switch (ZLIBG(output_compression)) { + case 0: + break; + case 1: + ZLIBG(output_compression) = PHP_OUTPUT_HANDLER_DEFAULT_SIZE; + default: + MAKE_STD_ZVAL(tmp); + ZVAL_ASCII_STRING(tmp, PHP_ZLIB_OUTPUT_HANDLER_NAME, ZSTR_DUPLICATE); + if ((h = php_zlib_output_handler_init(tmp TSRMLS_CC)) (SUCCESS == php_output_handler_start(h TSRMLS_CC))) { + if (ZLIBG(output_handler) *ZLIBG(output_handler)) { + MAKE_STD_ZVAL(zoh); + ZVAL_ASCII_STRING(zoh, ZLIBG(output_handler), ZSTR_DUPLICATE); + php_output_start_user(zoh, ZLIBG(output_compression), PHP_OUTPUT_HANDLER_STDFLAGS TSRMLS_CC); + zval_ptr_dtor(zoh); + } + } + zval_ptr_dtor(tmp); + break; + } +} +/* }}} */ + /* {{{ php_zlib_output_handler_init() */ php_output_handler *php_zlib_output_handler_init(zval *handler_name TSRMLS_DC) { @@ -172,7 +200,7 @@ php_output_handler_hook(PHP_OUTPUT_HANDLER_HOOK_GET_FLAGS, flags TSRMLS_CC); if (!(flags PHP_OUTPUT_HANDLER_STARTED)) { - if (SG(headers_sent)) { + if (SG(headers_sent) || !ZLIBG(output_compression)) { deflateEnd(ctx-Z); return FAILURE; } @@ -603,6 +631,7 @@ /* {{{ OnUpdate_zlib_output_compression */ static PHP_INI_MH(OnUpdate_zlib_output_compression) { + int status, int_value; char *ini_value; if (new_value == NULL) { @@ -616,26 +645,47 @@ new_value = 1; 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; } - if (stage == PHP_INI_STAGE_RUNTIME SG(headers_sent) !SG(request_info).no_headers) { - php_error_docref(ref.outcontrol TSRMLS_CC, E_WARNING, Cannot change zlib.output_compression - headers already sent); - return FAILURE; + status = php_output_get_status(TSRMLS_C); + if (stage == PHP_INI_STAGE_RUNTIME) { + if (status PHP_OUTPUT_SENT) { + php_error_docref(ref.outcontrol TSRMLS_CC, E_WARNING, Cannot change zlib.output_compression - headers already sent); + return FAILURE; + } else if ((status PHP_OUTPUT_WRITTEN) int_value) { + php_error_docref(ref.outcontrol TSRMLS_CC, E_WARNING, Cannot enable zlib.output_compression - there has already been output); + return FAILURE; + } } - - return 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); + + if (stage == PHP_INI_STAGE_RUNTIME int_value) { + zval tmp; + + INIT_PZVAL(tmp); + ZVAL_ASCII_STRING(tmp, PHP_ZLIB_OUTPUT_HANDLER_NAME, ZSTR_DUPLICATE); + if (!php_output_handler_started(tmp TSRMLS_CC)) { + php_zlib_output_compression_start(TSRMLS_C); + } + zval_dtor(tmp); + } + + return status;
[PHP-CVS] cvs: php-src /ext/zlib zlib.c
nlopess Thu Jul 27 15:53:47 2006 UTC Modified files: /php-src/ext/zlib zlib.c Log: convert void* to zstr when using the 't' parameter type http://cvs.php.net/viewvc.cgi/php-src/ext/zlib/zlib.c?r1=1.202r2=1.203diff_format=u Index: php-src/ext/zlib/zlib.c diff -u php-src/ext/zlib/zlib.c:1.202 php-src/ext/zlib/zlib.c:1.203 --- php-src/ext/zlib/zlib.c:1.202 Sat Jul 8 21:54:49 2006 +++ php-src/ext/zlib/zlib.c Thu Jul 27 15:53:47 2006 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: zlib.c,v 1.202 2006/07/08 21:54:49 nlopess Exp $ */ +/* $Id: zlib.c,v 1.203 2006/07/27 15:53:47 nlopess Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -275,7 +275,7 @@ Read and uncompress entire .gz-file into an array */ PHP_FUNCTION(gzfile) { - void *filename; + zstr filename; int filename_len; zend_uchar filename_type; long flags = 0; @@ -291,15 +291,15 @@ use_include_path = flags ? USE_PATH : 0; if (filename_type == IS_UNICODE) { - if (php_stream_path_encode(NULL, (char**)filename, filename_len, (UChar*)filename, filename_len, REPORT_ERRORS, NULL) == FAILURE) { + if (php_stream_path_encode(NULL, filename.s, filename_len, filename.u, filename_len, REPORT_ERRORS, NULL) == FAILURE) { RETURN_FALSE; } } /* using a stream here is a bit more efficient (resource wise) than php_gzopen_wrapper */ - stream = php_stream_gzopen(NULL, filename, rb, use_include_path | REPORT_ERRORS, NULL, NULL STREAMS_CC TSRMLS_CC); + stream = php_stream_gzopen(NULL, filename.s, rb, use_include_path | REPORT_ERRORS, NULL, NULL STREAMS_CC TSRMLS_CC); if (filename_type == IS_UNICODE) { - efree(filename); + efree(filename.s); } if (stream == NULL) { /* Error reporting is already done by stream code */ @@ -323,7 +323,7 @@ Open a .gz-file and return a .gz-file pointer */ PHP_FUNCTION(gzopen) { - void *filename; + zstr filename; char *mode; int filename_len, mode_len; zend_uchar filename_type; @@ -338,15 +338,15 @@ use_include_path = flags ? USE_PATH : 0; if (filename_type == IS_UNICODE) { - if (php_stream_path_encode(NULL, (char**)filename, filename_len, (UChar*)filename, filename_len, REPORT_ERRORS, NULL) == FAILURE) { + if (php_stream_path_encode(NULL, filename.s, filename_len, filename.u, filename_len, REPORT_ERRORS, NULL) == FAILURE) { RETURN_FALSE; } } - stream = php_stream_gzopen(NULL, filename, mode, use_include_path | REPORT_ERRORS, NULL, NULL STREAMS_CC TSRMLS_CC); + stream = php_stream_gzopen(NULL, filename.s, mode, use_include_path | REPORT_ERRORS, NULL, NULL STREAMS_CC TSRMLS_CC); if (filename_type == IS_UNICODE) { - efree(filename); + efree(filename.s); } if (!stream) { RETURN_FALSE; @@ -362,7 +362,7 @@ Output a .gz-file */ PHP_FUNCTION(readgzfile) { - char *filename; + zstr filename; int filename_len; zend_uchar filename_type; long flags = 0; @@ -377,14 +377,14 @@ use_include_path = flags ? USE_PATH : 0; if (filename_type == IS_UNICODE) { - if (php_stream_path_encode(NULL, filename, filename_len, (UChar*)filename, filename_len, REPORT_ERRORS, NULL) == FAILURE) { + if (php_stream_path_encode(NULL, filename.s, filename_len, filename.u, filename_len, REPORT_ERRORS, NULL) == FAILURE) { RETURN_FALSE; } } - stream = php_stream_gzopen(NULL, filename, rb, use_include_path, NULL, NULL STREAMS_CC TSRMLS_CC); + stream = php_stream_gzopen(NULL, filename.s, rb, use_include_path, NULL, NULL STREAMS_CC TSRMLS_CC); if (filename_type == IS_UNICODE) { - efree(filename); + efree(filename.s); } if (!stream) { RETURN_FALSE; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/zlib zlib.c
nlopess Sat Jul 8 21:54:49 2006 UTC Modified files: /php-src/ext/zlib zlib.c Log: change char* to void* when using the 't' parameter (as noted by Andrei) http://cvs.php.net/viewvc.cgi/php-src/ext/zlib/zlib.c?r1=1.201r2=1.202diff_format=u Index: php-src/ext/zlib/zlib.c diff -u php-src/ext/zlib/zlib.c:1.201 php-src/ext/zlib/zlib.c:1.202 --- php-src/ext/zlib/zlib.c:1.201 Fri Jul 7 23:30:30 2006 +++ php-src/ext/zlib/zlib.c Sat Jul 8 21:54:49 2006 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: zlib.c,v 1.201 2006/07/07 23:30:30 nlopess Exp $ */ +/* $Id: zlib.c,v 1.202 2006/07/08 21:54:49 nlopess Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -275,7 +275,7 @@ Read and uncompress entire .gz-file into an array */ PHP_FUNCTION(gzfile) { - char *filename; + void *filename; int filename_len; zend_uchar filename_type; long flags = 0; @@ -291,7 +291,7 @@ use_include_path = flags ? USE_PATH : 0; if (filename_type == IS_UNICODE) { - if (php_stream_path_encode(NULL, filename, filename_len, (UChar*)filename, filename_len, REPORT_ERRORS, NULL) == FAILURE) { + if (php_stream_path_encode(NULL, (char**)filename, filename_len, (UChar*)filename, filename_len, REPORT_ERRORS, NULL) == FAILURE) { RETURN_FALSE; } } @@ -323,7 +323,8 @@ Open a .gz-file and return a .gz-file pointer */ PHP_FUNCTION(gzopen) { - char *filename, *mode; + void *filename; + char *mode; int filename_len, mode_len; zend_uchar filename_type; long flags = 0; @@ -337,7 +338,7 @@ use_include_path = flags ? USE_PATH : 0; if (filename_type == IS_UNICODE) { - if (php_stream_path_encode(NULL, filename, filename_len, (UChar*)filename, filename_len, REPORT_ERRORS, NULL) == FAILURE) { + if (php_stream_path_encode(NULL, (char**)filename, filename_len, (UChar*)filename, filename_len, REPORT_ERRORS, NULL) == FAILURE) { RETURN_FALSE; } } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/zlib zlib.c
nlopess Fri Jul 7 23:30:30 2006 UTC Modified files: /php-src/ext/zlib zlib.c Log: upgrade a couple of functions to Unicode http://cvs.php.net/viewvc.cgi/php-src/ext/zlib/zlib.c?r1=1.200r2=1.201diff_format=u Index: php-src/ext/zlib/zlib.c diff -u php-src/ext/zlib/zlib.c:1.200 php-src/ext/zlib/zlib.c:1.201 --- php-src/ext/zlib/zlib.c:1.200 Mon Jun 26 23:22:45 2006 +++ php-src/ext/zlib/zlib.c Fri Jul 7 23:30:30 2006 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: zlib.c,v 1.200 2006/06/26 23:22:45 tony2001 Exp $ */ +/* $Id: zlib.c,v 1.201 2006/07/07 23:30:30 nlopess Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -271,26 +271,36 @@ } /* }}} */ -/* {{{ proto array gzfile(string filename [, int use_include_path]) - Read und uncompress entire .gz-file into an array */ +/* {{{ proto array gzfile(string filename [, int use_include_path]) U + Read and uncompress entire .gz-file into an array */ PHP_FUNCTION(gzfile) { char *filename; int filename_len; + zend_uchar filename_type; long flags = 0; char buf[8192]; register int i = 0; int use_include_path = 0; php_stream *stream; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s|l, filename, filename_len, flags) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, t|l, filename, filename_len, filename_type, flags) == FAILURE) { return; } use_include_path = flags ? USE_PATH : 0; + if (filename_type == IS_UNICODE) { + if (php_stream_path_encode(NULL, filename, filename_len, (UChar*)filename, filename_len, REPORT_ERRORS, NULL) == FAILURE) { + RETURN_FALSE; + } + } + /* using a stream here is a bit more efficient (resource wise) than php_gzopen_wrapper */ stream = php_stream_gzopen(NULL, filename, rb, use_include_path | REPORT_ERRORS, NULL, NULL STREAMS_CC TSRMLS_CC); + if (filename_type == IS_UNICODE) { + efree(filename); + } if (stream == NULL) { /* Error reporting is already done by stream code */ RETURN_FALSE; @@ -309,24 +319,34 @@ } /* }}} */ -/* {{{ proto resource gzopen(string filename, string mode [, int use_include_path]) +/* {{{ proto resource gzopen(string filename, string mode [, int use_include_path]) U Open a .gz-file and return a .gz-file pointer */ PHP_FUNCTION(gzopen) { char *filename, *mode; int filename_len, mode_len; + zend_uchar filename_type; long flags = 0; php_stream *stream; int use_include_path = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ss|l, filename, filename_len, mode, mode_len, flags) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ts|l, filename, filename_len, filename_type, mode, mode_len, flags) == FAILURE) { return; } use_include_path = flags ? USE_PATH : 0; + if (filename_type == IS_UNICODE) { + if (php_stream_path_encode(NULL, filename, filename_len, (UChar*)filename, filename_len, REPORT_ERRORS, NULL) == FAILURE) { + RETURN_FALSE; + } + } + stream = php_stream_gzopen(NULL, filename, mode, use_include_path | REPORT_ERRORS, NULL, NULL STREAMS_CC TSRMLS_CC); + if (filename_type == IS_UNICODE) { + efree(filename); + } if (!stream) { RETURN_FALSE; } @@ -337,24 +357,34 @@ /* * Read a file and write the ouput to stdout */ -/* {{{ proto int readgzfile(string filename [, int use_include_path]) +/* {{{ proto int readgzfile(string filename [, int use_include_path]) U Output a .gz-file */ PHP_FUNCTION(readgzfile) { char *filename; int filename_len; + zend_uchar filename_type; long flags = 0; php_stream *stream; int size; int use_include_path = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s|l, filename, filename_len, flags) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, t|l, filename, filename_len, filename_type, flags) == FAILURE) { return; } use_include_path = flags ? USE_PATH : 0; + if (filename_type == IS_UNICODE) { + if (php_stream_path_encode(NULL, filename, filename_len, (UChar*)filename, filename_len, REPORT_ERRORS, NULL) == FAILURE) { + RETURN_FALSE; + } + } + stream = php_stream_gzopen(NULL, filename, rb, use_include_path, NULL, NULL STREAMS_CC TSRMLS_CC); + if (filename_type == IS_UNICODE) { + efree(filename); + } if (!stream) { RETURN_FALSE; } @@ -593,16 +623,16 @@
Re: [PHP-CVS] cvs: php-src /ext/zlib zlib.c
+/* {{{ proto array gzfile(string filename [, int use_include_path]) U + Read and uncompress entire .gz-file into an array */ PHP_FUNCTION(gzfile) { char *filename; int filename_len; + zend_uchar filename_type; long flags = 0; char buf[8192]; register int i = 0; int use_include_path = 0; php_stream *stream; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s|l, filename, filename_len, flags) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, t|l, filename, filename_len, filename_type, flags) == FAILURE) { return; } When you use 't' flag, the storage type should be void*, not char*. -Andrei -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/zlib zlib.c
tony2001Mon Jun 26 22:53:42 2006 UTC Modified files: /php-src/ext/zlib zlib.c Log: MFB: don't try to inflate empty strings http://cvs.php.net/viewvc.cgi/php-src/ext/zlib/zlib.c?r1=1.198r2=1.199diff_format=u Index: php-src/ext/zlib/zlib.c diff -u php-src/ext/zlib/zlib.c:1.198 php-src/ext/zlib/zlib.c:1.199 --- php-src/ext/zlib/zlib.c:1.198 Tue Jun 13 13:12:20 2006 +++ php-src/ext/zlib/zlib.c Mon Jun 26 22:53:42 2006 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: zlib.c,v 1.198 2006/06/13 13:12:20 dmitry Exp $ */ +/* $Id: zlib.c,v 1.199 2006/06/26 22:53:42 tony2001 Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -528,6 +528,10 @@ return; } + if (!data_len) { + RETURN_FALSE; + } + if (limit 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, length (%ld) must be greater or equal zero, limit); RETURN_FALSE; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/zlib zlib.c
tony2001Mon Jun 26 23:22:45 2006 UTC Modified files: /php-src/ext/zlib zlib.c Log: zero-terminate strings produced with FORCE_DEFLATE http://cvs.php.net/viewvc.cgi/php-src/ext/zlib/zlib.c?r1=1.199r2=1.200diff_format=u Index: php-src/ext/zlib/zlib.c diff -u php-src/ext/zlib/zlib.c:1.199 php-src/ext/zlib/zlib.c:1.200 --- php-src/ext/zlib/zlib.c:1.199 Mon Jun 26 22:53:42 2006 +++ php-src/ext/zlib/zlib.c Mon Jun 26 23:22:45 2006 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: zlib.c,v 1.199 2006/06/26 22:53:42 tony2001 Exp $ */ +/* $Id: zlib.c,v 1.200 2006/06/26 23:22:45 tony2001 Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -817,6 +817,8 @@ trailer[6] = (char) (stream.total_in 16) 0xFF; trailer[7] = (char) (stream.total_in 24) 0xFF; trailer[8] = '\0'; + } else { + s2[stream.total_out + GZIP_HEADER_LENGTH + (coding == CODING_GZIP ? GZIP_FOOTER_LENGTH : 0)] = '\0'; } RETURN_STRINGL(s2, stream.total_out + GZIP_HEADER_LENGTH + (coding == CODING_GZIP ? GZIP_FOOTER_LENGTH : 0), 0); } else { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/zlib zlib.c
fmk Sat Apr 29 14:38:35 2006 UTC Modified files: /php-src/ext/zlib zlib.c Log: fix build. ZSTR() must be applied to the buf argument of php_stream macros http://cvs.php.net/viewcvs.cgi/php-src/ext/zlib/zlib.c?r1=1.192r2=1.193diff_format=u Index: php-src/ext/zlib/zlib.c diff -u php-src/ext/zlib/zlib.c:1.192 php-src/ext/zlib/zlib.c:1.193 --- php-src/ext/zlib/zlib.c:1.192 Wed Mar 8 14:41:45 2006 +++ php-src/ext/zlib/zlib.c Sat Apr 29 14:38:35 2006 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: zlib.c,v 1.192 2006/03/08 14:41:45 iliaa Exp $ */ +/* $Id: zlib.c,v 1.193 2006/04/29 14:38:35 fmk Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -305,7 +305,7 @@ /* Now loop through the file and do the magic quotes thing if needed */ memset(buf,0,sizeof(buf)); - while (php_stream_gets(stream, buf, sizeof(buf) - 1) != NULL) { + while (php_stream_gets(stream, ZSTR(buf), sizeof(buf) - 1) != NULL) { add_index_string(return_value, i++, buf, 1); } php_stream_close(stream); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/zlib zlib.c
mikeTue Oct 25 11:13:55 2005 EDT Modified files: /php-src/ext/zlib zlib.c Log: - fix bug #34821 zlib encoders fail on widely varying binary data on windows http://cvs.php.net/diff.php/php-src/ext/zlib/zlib.c?r1=1.185r2=1.186ty=u Index: php-src/ext/zlib/zlib.c diff -u php-src/ext/zlib/zlib.c:1.185 php-src/ext/zlib/zlib.c:1.186 --- php-src/ext/zlib/zlib.c:1.185 Fri Sep 2 13:25:10 2005 +++ php-src/ext/zlib/zlib.c Tue Oct 25 11:13:55 2005 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: zlib.c,v 1.185 2005/09/02 17:25:10 iliaa Exp $ */ +/* $Id: zlib.c,v 1.186 2005/10/25 15:13:55 mike Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -70,6 +70,13 @@ #endif #endif +/* Win32 needs some more memory */ +#ifdef PHP_WIN32 +#define PHP_ZLIB_MODIFIER 100 +#else +#define PHP_ZLIB_MODIFIER 1000 +#endif + #define OS_CODE0x03 /* FIXME */ #define GZIP_HEADER_LENGTH 10 #define GZIP_FOOTER_LENGTH 8 @@ -386,7 +393,7 @@ RETURN_FALSE; } - l2 = data_len + (data_len / 1000) + 15 + 1; /* room for \0 */ + l2 = data_len + (data_len / PHP_ZLIB_MODIFIER) + 15 + 1; /* room for \0 */ s2 = (char *) emalloc(l2); if (!s2) { RETURN_FALSE; @@ -482,7 +489,7 @@ stream.next_in = (Bytef *) data; stream.avail_in = data_len; - stream.avail_out = stream.avail_in + (stream.avail_in / 1000) + 15 + 1; /* room for \0 */ + stream.avail_out = stream.avail_in + (stream.avail_in / PHP_ZLIB_MODIFIER) + 15 + 1; /* room for \0 */ s2 = (char *) emalloc(stream.avail_out); if (!s2) { @@ -618,7 +625,7 @@ int start_offset = ((do_start ZLIBG(compression_coding) == CODING_GZIP) ? 10 : 0); int end_offset = (do_end ? 8 : 0); - outlen = (uint) (sizeof(char) * (str_length * 1.001f + 12) + 1); /* leave some room for a trailing \0 */ + outlen = (uint) (sizeof(char) * (str_length / PHP_ZLIB_MODIFIER + 12) + 1); /* leave some room for a trailing \0 */ if ((outlen + start_offset + end_offset) *p_buffer_len) { buffer = (Bytef *) emalloc(outlen + start_offset + end_offset); } else { @@ -758,7 +765,7 @@ stream.next_in = (Bytef *) data; stream.avail_in = data_len; - stream.avail_out = stream.avail_in + (stream.avail_in / 1000) + 15 + 1; /* room for \0 */ + stream.avail_out = stream.avail_in + (stream.avail_in / PHP_ZLIB_MODIFIER) + 15 + 1; /* room for \0 */ s2 = (char *) emalloc(stream.avail_out + GZIP_HEADER_LENGTH + (coding == CODING_GZIP ? GZIP_FOOTER_LENGTH : 0)); /* add gzip file header */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/zlib zlib.c
mikeTue Oct 25 11:35:24 2005 EDT Modified files: /php-src/ext/zlib zlib.c Log: - fix the fix http://cvs.php.net/diff.php/php-src/ext/zlib/zlib.c?r1=1.186r2=1.187ty=u Index: php-src/ext/zlib/zlib.c diff -u php-src/ext/zlib/zlib.c:1.186 php-src/ext/zlib/zlib.c:1.187 --- php-src/ext/zlib/zlib.c:1.186 Tue Oct 25 11:13:55 2005 +++ php-src/ext/zlib/zlib.c Tue Oct 25 11:35:22 2005 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: zlib.c,v 1.186 2005/10/25 15:13:55 mike Exp $ */ +/* $Id: zlib.c,v 1.187 2005/10/25 15:35:22 mike Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -625,7 +625,7 @@ int start_offset = ((do_start ZLIBG(compression_coding) == CODING_GZIP) ? 10 : 0); int end_offset = (do_end ? 8 : 0); - outlen = (uint) (sizeof(char) * (str_length / PHP_ZLIB_MODIFIER + 12) + 1); /* leave some room for a trailing \0 */ + outlen = (uint) (str_length + (str_length / PHP_ZLIB_MODIFIER) + 12 + 1); /* leave some room for a trailing \0 */ if ((outlen + start_offset + end_offset) *p_buffer_len) { buffer = (Bytef *) emalloc(outlen + start_offset + end_offset); } else { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/zlib zlib.c
iliaa Fri Sep 2 13:25:10 2005 EDT Modified files: /php-src/ext/zlib zlib.c Log: Resolved bug #34240. # Thanks to xuefer at 21cn dot com for providing it. http://cvs.php.net/diff.php/php-src/ext/zlib/zlib.c?r1=1.184r2=1.185ty=u Index: php-src/ext/zlib/zlib.c diff -u php-src/ext/zlib/zlib.c:1.184 php-src/ext/zlib/zlib.c:1.185 --- php-src/ext/zlib/zlib.c:1.184 Sun Aug 21 12:02:25 2005 +++ php-src/ext/zlib/zlib.c Fri Sep 2 13:25:10 2005 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: zlib.c,v 1.184 2005/08/21 16:02:25 iliaa Exp $ */ +/* $Id: zlib.c,v 1.185 2005/09/02 17:25:10 iliaa Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -644,7 +644,7 @@ if (do_end) { err = deflate(ZLIBG(stream), Z_FINISH); - buffer[outlen - ZLIBG(stream).avail_out] = '\0'; + buffer[outlen + start_offset - ZLIBG(stream).avail_out] = '\0'; } *p_buffer = buffer; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/zlib zlib.c
How are we doing with this? Is it a new bug in 5.0.5 and 5.1.0? At 12:06 PM 8/24/2005, Xuefer wrote: this patch produce bug: http://bugs.php.net/bug.php?id=34240 -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/zlib zlib.c
this patch produce bug: http://bugs.php.net/bug.php?id=34240 -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/zlib zlib.c
iliaa Sun Aug 21 12:02:27 2005 EDT Modified files: /php-src/ext/zlib zlib.c Log: Fixed bug #34191 (ob_gzhandler does not enforce trailing \0). http://cvs.php.net/diff.php/php-src/ext/zlib/zlib.c?r1=1.183r2=1.184ty=u Index: php-src/ext/zlib/zlib.c diff -u php-src/ext/zlib/zlib.c:1.183 php-src/ext/zlib/zlib.c:1.184 --- php-src/ext/zlib/zlib.c:1.183 Wed Aug 3 10:08:23 2005 +++ php-src/ext/zlib/zlib.c Sun Aug 21 12:02:25 2005 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: zlib.c,v 1.183 2005/08/03 14:08:23 sniper Exp $ */ +/* $Id: zlib.c,v 1.184 2005/08/21 16:02:25 iliaa Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -644,6 +644,7 @@ if (do_end) { err = deflate(ZLIBG(stream), Z_FINISH); + buffer[outlen - ZLIBG(stream).avail_out] = '\0'; } *p_buffer = buffer; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/zlib zlib.c
sr Sun Aug 24 09:32:51 2003 EDT Modified files: /php-src/ext/zlib zlib.c Log: Fixed zlib.output_compression without register_long_vars set. Index: php-src/ext/zlib/zlib.c diff -u php-src/ext/zlib/zlib.c:1.175 php-src/ext/zlib/zlib.c:1.176 --- php-src/ext/zlib/zlib.c:1.175 Sun Aug 10 21:56:43 2003 +++ php-src/ext/zlib/zlib.c Sun Aug 24 09:32:50 2003 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: zlib.c,v 1.175 2003/08/11 01:56:43 sniper Exp $ */ +/* $Id: zlib.c,v 1.176 2003/08/24 13:32:50 sr Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -1046,11 +1046,12 @@ */ int php_enable_output_compression(int buffer_size TSRMLS_DC) { - zval **a_encoding, **data; + zval **a_encoding; - if (zend_hash_find(EG(symbol_table), HTTP_SERVER_VARS, sizeof(HTTP_SERVER_VARS), (void **) data) == FAILURE - || Z_TYPE_PP(data) != IS_ARRAY - || zend_hash_find(Z_ARRVAL_PP(data), HTTP_ACCEPT_ENCODING, sizeof(HTTP_ACCEPT_ENCODING), (void **) a_encoding) == FAILURE + zend_is_auto_global(_SERVER, sizeof(_SERVER)-1 TSRMLS_CC); + + if (!PG(http_globals)[TRACK_VARS_SERVER] + || zend_hash_find(PG(http_globals)[TRACK_VARS_SERVER]-value.ht, HTTP_ACCEPT_ENCODING, sizeof(HTTP_ACCEPT_ENCODING), (void **) a_encoding) == FAILURE ) { return FAILURE; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/zlib zlib.c
sniper Sun Aug 10 21:56:43 2003 EDT Modified files: /php-src/ext/zlib zlib.c Log: Nuke unused variable Index: php-src/ext/zlib/zlib.c diff -u php-src/ext/zlib/zlib.c:1.174 php-src/ext/zlib/zlib.c:1.175 --- php-src/ext/zlib/zlib.c:1.174 Sat Aug 9 07:20:38 2003 +++ php-src/ext/zlib/zlib.c Sun Aug 10 21:56:43 2003 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: zlib.c,v 1.174 2003/08/09 11:20:38 derick Exp $ */ +/* $Id: zlib.c,v 1.175 2003/08/11 01:56:43 sniper Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -326,7 +326,6 @@ { zval **arg1, **arg2, **arg3; php_stream *stream; - char *p; int use_include_path = 0; switch (ZEND_NUM_ARGS()) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/zlib zlib.c
derick Sat Aug 9 07:20:38 2003 EDT Modified files: /php-src/ext/zlib zlib.c Log: - Fix memleak (this strndup is totally unnecessary) Index: php-src/ext/zlib/zlib.c diff -u php-src/ext/zlib/zlib.c:1.173 php-src/ext/zlib/zlib.c:1.174 --- php-src/ext/zlib/zlib.c:1.173 Sun Jul 27 14:16:06 2003 +++ php-src/ext/zlib/zlib.c Sat Aug 9 07:20:38 2003 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: zlib.c,v 1.173 2003/07/27 18:16:06 iliaa Exp $ */ +/* $Id: zlib.c,v 1.174 2003/08/09 11:20:38 derick Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -349,13 +349,11 @@ convert_to_string_ex(arg1); convert_to_string_ex(arg2); - p = estrndup(Z_STRVAL_PP(arg2), Z_STRLEN_PP(arg2)); - - stream = php_stream_gzopen(NULL, Z_STRVAL_PP(arg1), p, use_include_path | ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL, NULL STREAMS_CC TSRMLS_CC); + stream = php_stream_gzopen(NULL, Z_STRVAL_PP(arg1), Z_STRVAL_PP(arg2), use_include_path | ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL, NULL STREAMS_CC TSRMLS_CC); + if (!stream) { RETURN_FALSE; } - efree(p); php_stream_to_zval(stream, return_value); } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/zlib zlib.c
iliaa Sun Jul 27 14:16:06 2003 EDT Modified files: /php-src/ext/zlib zlib.c Log: Fixed bug #24827 (ob_gzhandler overrides Vary header) Index: php-src/ext/zlib/zlib.c diff -u php-src/ext/zlib/zlib.c:1.172 php-src/ext/zlib/zlib.c:1.173 --- php-src/ext/zlib/zlib.c:1.172 Sat Jul 19 15:23:33 2003 +++ php-src/ext/zlib/zlib.c Sun Jul 27 14:16:06 2003 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: zlib.c,v 1.172 2003/07/19 19:23:33 andrey Exp $ */ +/* $Id: zlib.c,v 1.173 2003/07/27 18:16:06 iliaa Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -993,7 +993,7 @@ if (sapi_add_header(Content-Encoding: gzip, sizeof(Content-Encoding: gzip) - 1, 1) == FAILURE) { return_original = 1; } - if (sapi_add_header(Vary: Accept-Encoding, sizeof(Vary: Accept-Encoding) - 1, 1) == FAILURE) { + if (sapi_add_header_ex(Vary: Accept-Encoding, sizeof(Vary: Accept-Encoding) - 1, 1, 0 TSRMLS_CC)==FAILURE) { return_original = 1; } break; @@ -1001,7 +1001,7 @@ if (sapi_add_header(Content-Encoding: deflate, sizeof(Content-Encoding: deflate) - 1, 1) == FAILURE) { return_original = 1; } - if (sapi_add_header(Vary: Accept-Encoding, sizeof(Vary: Accept-Encoding) - 1, 1) == FAILURE) { + if (sapi_add_header_ex(Vary: Accept-Encoding, sizeof(Vary: Accept-Encoding) - 1, 1, 0 TSRMLS_CC)==FAILURE) { return_original = 1; } break; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php