cvs: php-src /ext/zip php_zip.c

From: Date: Tue, 31 Oct 2006 19:34:41 +0000
Subject: cvs: php-src /ext/zip php_zip.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-41264@lists.php.net to get a copy of this message
pajoye Tue Oct 31 19:34:41 2006 UTC Modified files: /php-src/ext/zip php_zip.c Log: - mark extractTo as U-ready, path and filenames are now encoded correctly http://cvs.php.net/viewvc.cgi/php-src/ext/zip/php_zip.c?r1=1.24&r2=1.25&diff_format=u Index: php-src/ext/zip/php_zip.c diff -u php-src/ext/zip/php_zip.c:1.24 php-src/ext/zip/php_zip.c:1.25 --- php-src/ext/zip/php_zip.c:1.24 Tue Oct 31 19:03:57 2006 +++ php-src/ext/zip/php_zip.c Tue Oct 31 19:34:41 2006 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_zip.c,v 1.24 2006/10/31 19:03:57 pajoye Exp $ */ +/* $Id: php_zip.c,v 1.25 2006/10/31 19:34:41 pajoye Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -1658,6 +1658,7 @@ zval **pathto_zval; char *pathto; char *file; + int file_len; int pathto_len; int ret, i; @@ -1691,9 +1692,22 @@ if (zval_files) { switch (Z_TYPE_P(zval_files)) { case IS_UNICODE: + if (FAILURE == php_stream_path_param_encode(&zval_files, &file, &file_len, REPORT_ERRORS, FG(default_context))) { + RETURN_FALSE; + } case IS_STRING: - file = Z_STRVAL_P(zval_files); + if (Z_TYPE_P(zval_files) != IS_UNICODE) { + file_len = Z_STRLEN_P(zval_files); + file = Z_STRVAL_P(zval_files); + } + if (file_len < 1) { + efree(file); + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Empty string as filename"); + RETURN_FALSE; + } + if (!php_zip_extract_file(intern, pathto, file TSRMLS_CC)) { + efree(file); RETURN_FALSE; } break; @@ -1707,9 +1721,23 @@ switch (Z_TYPE_PP(zval_file)) { case IS_LONG: break; + case IS_UNICODE: + if (FAILURE == php_stream_path_param_encode(zval_file, &file, &file_len, REPORT_ERRORS, FG(default_context))) { + RETURN_FALSE; + } case IS_STRING: - file = Z_STRVAL_PP(zval_file); + if (Z_TYPE_P(zval_files) != IS_UNICODE) { + file_len = Z_STRLEN_PP(zval_file); + file = Z_STRVAL_PP(zval_file); + } + if (file_len < 1) { + efree(file); + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Empty string as filename"); + RETURN_FALSE; + } + if (!php_zip_extract_file(intern, pathto, file TSRMLS_CC)) { + efree(file); RETURN_FALSE; } break; @@ -1993,7 +2021,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "Zip", "enabled"); - php_info_print_table_row(2, "Extension Version","$Id: php_zip.c,v 1.24 2006/10/31 19:03:57 pajoye Exp $"); + php_info_print_table_row(2, "Extension Version","$Id: php_zip.c,v 1.25 2006/10/31 19:34:41 pajoye Exp $"); php_info_print_table_row(2, "Zip version", "2.0.0"); php_info_print_table_row(2, "Libzip version", "0.7.1");

« previous php.cvs (#41264) next »