pajoye Tue Oct 31 14:27:09 2006 UTC Modified files: /php-src/ext/zip php_zip.c php_zip.h /php-src/ext/zip/tests bug38943.phpt bug38944.phpt oo_extract.phpt Log: - initial unicode support . entry names will be converted to ascii. zip works with cp437 when 7zip support will be added, unicode string will be supported . path and filenames are now encoded using php_stream_path_param_encode if the filename/path is used as entry name, it is converted to ascii . the stream (getStream and zip://) needs some tweak. I'm not sure if it should return unicode or binary, neither how to change the default. For now it returns unicode (seems to be the default :) comments/suggestions welcome
http://cvs.php.net/viewvc.cgi/php-src/ext/zip/php_zip.c?r1=1.22&r2=1.23&diff_format=u Index: php-src/ext/zip/php_zip.c diff -u php-src/ext/zip/php_zip.c:1.22 php-src/ext/zip/php_zip.c:1.23 --- php-src/ext/zip/php_zip.c:1.22 Mon Oct 30 23:00:54 2006 +++ php-src/ext/zip/php_zip.c Tue Oct 31 14:27:09 2006 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_zip.c,v 1.22 2006/10/30 23:00:54 pajoye Exp $ */ +/* $Id: php_zip.c,v 1.23 2006/10/31 14:27:09 pajoye Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -183,13 +183,13 @@ #define RETURN_SB(sb) \ { \ array_init(return_value); \ - add_assoc_string(return_value, "name", (char *)(sb)->name, 1); \ - add_assoc_long(return_value, "index", (long) (sb)->index); \ - add_assoc_long(return_value, "crc", (long) (sb)->crc); \ - add_assoc_long(return_value, "size", (long) (sb)->size); \ - add_assoc_long(return_value, "mtime", (long) (sb)->mtime); \ - add_assoc_long(return_value, "comp_size", (long) (sb)->comp_size); \ - add_assoc_long(return_value, "comp_method", (long) (sb)->comp_method); \ + add_ascii_assoc_string(return_value, "name", (char *)(sb)->name, 1); \ + add_ascii_assoc_long(return_value, "index", (long) (sb)->index); \ + add_ascii_assoc_long(return_value, "crc", (long) (sb)->crc); \ + add_ascii_assoc_long(return_value, "size", (long) (sb)->size); \ + add_ascii_assoc_long(return_value, "mtime", (long) (sb)->mtime); \ + add_ascii_assoc_long(return_value, "comp_size", (long) (sb)->comp_size); \ + add_ascii_assoc_long(return_value, "comp_method", (long) (sb)->comp_method); \ } /* }}} */ @@ -238,7 +238,6 @@ return NULL; } /* }}} */ - #endif /* {{{ zend_function_entry */ @@ -851,11 +850,12 @@ /* }}} */ #ifdef ZEND_ENGINE_2_1 -/* {{{ proto mixed open(string source [, int flags]) +/* {{{ proto mixed open(string source [, int flags]) U Create new zip using source uri for output, return TRUE on success or the error code */ ZIPARCHIVE_METHOD(open) { struct zip *intern; + zval **filename_zval; char *filename; int filename_len; int err = 0; @@ -865,7 +865,7 @@ zval *this = getThis(); ze_zip_object *ze_obj = NULL; - 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, "Z|l", &filename_zval, &flags) == FAILURE) { return; } @@ -874,6 +874,10 @@ ze_obj = (ze_zip_object*) zend_object_store_get_object(this TSRMLS_CC); } + if (FAILURE == php_stream_path_param_encode(filename_zval, &filename, &filename_len, REPORT_ERRORS, FG(default_context))) { + RETURN_FALSE; + } + if (filename_len == 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty string as source"); RETURN_FALSE; @@ -902,7 +906,7 @@ } /* }}} */ -/* {{{ proto bool close() +/* {{{ proto bool close() U close the zip archive */ ZIPARCHIVE_METHOD(close) { @@ -931,19 +935,20 @@ } /* }}} */ -/* {{{ proto bool addFile(string filepath[, string entryname[, int start [, int length]]]) +/* {{{ proto bool addFile(string filepath[, string entryname[, int start [, int length]]]) U Add a file in a Zip archive using its path and the name to use. */ ZIPARCHIVE_METHOD(addFile) { struct zip *intern; zval *this = getThis(); + zval **filename_zval; char *filename; int filename_len; char *entry_name = NULL; int entry_name_len = 0; struct zip_source *zs; long offset_start = 0, offset_len = 0; - int cur_idx; + int cur_idx, res; char resolved_path[MAXPATHLEN + 1]; if (!this) { @@ -952,19 +957,36 @@ ZIP_FROM_OBJECT(intern, this); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|sll", - &filename, &filename_len, &entry_name, &entry_name_len, &offset_start, &offset_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z|s&ll", + &filename_zval, + &entry_name, &entry_name_len, UG(ascii_conv), + &offset_start, &offset_len) == FAILURE) { return; } + if (FAILURE == php_stream_path_param_encode(filename_zval, &filename, &filename_len, REPORT_ERRORS, FG(default_context))) { + RETURN_FALSE; + } + if (filename_len == 0) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Empty string as filename"); RETURN_FALSE; } if (entry_name_len == 0) { - entry_name = filename; - entry_name_len = filename_len; + /* if the filename was given in unicode, we need to convert it to ascii, only ascii (cp437) can be safely used in + zip entry names. */ + if (Z_TYPE_PP(filename_zval) == IS_UNICODE) { + entry_name = zend_unicode_to_ascii((UChar*)Z_USTRVAL_PP(filename_zval), Z_USTRLEN_PP(filename_zval) TSRMLS_CC); + if (!entry_name) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Binary or ASCII-Unicode string expected, non-ASCII-Unicode string received. Cannot convert the filename."); + RETURN_FALSE; + } + entry_name_len = strlen(entry_name); + } else { + entry_name = filename; + entry_name_len = filename_len; + } } if(!expand_filepath(filename, resolved_path TSRMLS_CC)) { @@ -987,19 +1009,27 @@ } else { if (zip_delete(intern, cur_idx) == -1) { + if (Z_TYPE_PP(filename_zval) == IS_UNICODE) { + efree(entry_name); + } RETURN_FALSE; } } - if (zip_add(intern, entry_name, zs) == -1) { + res = zip_add(intern, entry_name, zs); + if (Z_TYPE_PP(filename_zval) == IS_UNICODE) { + efree(entry_name); + } + if (res == -1) { RETURN_FALSE; } else { RETURN_TRUE; } + } /* }}} */ -/* {{{ proto bool addFromString(string name, string content) +/* {{{ proto bool addFromString(string name, string content) U Add a file using content and the entry name */ ZIPARCHIVE_METHOD(addFromString) { @@ -1018,6 +1048,12 @@ ZIP_FROM_OBJECT(intern, this); + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s&s&", + &name, &name_len, UG(ascii_conv), + &buffer, &buffer_len, UG(ascii_conv)) == FAILURE) { + return; + } + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &name, &name_len, &buffer, &buffer_len) == FAILURE) { return; @@ -1064,7 +1100,7 @@ } /* }}} */ -/* {{{ proto array statName(string filename[, int flags]) +/* {{{ proto array statName(string filename[, int flags]) U Returns the information about a the zip entry filename */ ZIPARCHIVE_METHOD(statName) { @@ -1081,8 +1117,8 @@ ZIP_FROM_OBJECT(intern, this); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", - &name, &name_len, &flags) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s&|l", + &name, &name_len, UG(ascii_conv), &flags) == FAILURE) { return; } @@ -1092,7 +1128,7 @@ } /* }}} */ -/* {{{ proto resource statIndex(int index[, int flags]) +/* {{{ proto resource statIndex(int index[, int flags]) U Returns the zip entry informations using its index */ ZIPARCHIVE_METHOD(statIndex) { @@ -1120,7 +1156,7 @@ } /* }}} */ -/* {{{ proto int locateName(string filename[, int flags]) +/* {{{ proto int locateName(string filename[, int flags]) U Returns the index of the entry named filename in the archive */ ZIPARCHIVE_METHOD(locateName) { @@ -1137,8 +1173,8 @@ ZIP_FROM_OBJECT(intern, this); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", - &name, &name_len, &flags) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s&|l", + &name, &name_len, UG(ascii_conv), &flags) == FAILURE) { return; } if (name_len<1) { @@ -1160,7 +1196,7 @@ } /* }}} */ -/* {{{ proto string getNameIndex(int index [, int flags]) +/* {{{ proto string getNameIndex(int index [, int flags]) U Returns the name of the file at position index */ ZIPARCHIVE_METHOD(getNameIndex) { @@ -1190,7 +1226,7 @@ } /* }}} */ -/* {{{ proto bool setArchiveComment(string name, string comment) +/* {{{ proto bool setArchiveComment(string name, string comment) U Set or remove (NULL/'') the comment of the archive */ ZIPARCHIVE_METHOD(setArchiveComment) { @@ -1205,7 +1241,7 @@ ZIP_FROM_OBJECT(intern, this); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &comment, &comment_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s&", &comment, &comment_len, UG(ascii_conv)) == FAILURE) { return; } if (zip_set_archive_comment(intern, (const char *)comment, (int)comment_len)) { @@ -1216,7 +1252,7 @@ } /* }}} */ -/* {{{ proto string getArchiveComment() +/* {{{ proto string getArchiveComment() U Returns the comment of an entry using its index */ ZIPARCHIVE_METHOD(getArchiveComment) { @@ -1241,7 +1277,7 @@ } /* }}} */ -/* {{{ proto bool setCommentName(string name, string comment) +/* {{{ proto bool setCommentName(string name, string comment) U Set or remove (NULL/'') the comment of an entry using its Name */ ZIPARCHIVE_METHOD(setCommentName) { @@ -1257,8 +1293,9 @@ ZIP_FROM_OBJECT(intern, this); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", - &name, &name_len, &comment, &comment_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s&s&", + &name, &name_len, UG(ascii_conv), + &comment, &comment_len, UG(ascii_conv)) == FAILURE) { return; } @@ -1270,7 +1307,7 @@ } /* }}} */ -/* {{{ proto bool setCommentIndex(int index, string comment) +/* {{{ proto bool setCommentIndex(int index, string comment) U Set or remove (NULL/'') the comment of an entry using its index */ ZIPARCHIVE_METHOD(setCommentIndex) { @@ -1287,8 +1324,8 @@ ZIP_FROM_OBJECT(intern, this); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", - &index, &comment, &comment_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls&", + &index, &comment, &comment_len, UG(ascii_conv)) == FAILURE) { return; } @@ -1297,7 +1334,7 @@ } /* }}} */ -/* {{{ proto string getCommentName(string name) +/* {{{ proto string getCommentName(string name) U Returns the comment of an entry using its name */ ZIPARCHIVE_METHOD(getCommentName) { @@ -1316,8 +1353,8 @@ ZIP_FROM_OBJECT(intern, this); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", - &name, &name_len, &flags) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s&|l", + &name, &name_len, UG(ascii_conv), &flags) == FAILURE) { return; } @@ -1327,7 +1364,7 @@ } /* }}} */ -/* {{{ proto string getCommentIndex(int index) +/* {{{ proto string getCommentIndex(int index) U Returns the comment of an entry using its index */ ZIPARCHIVE_METHOD(getCommentIndex) { @@ -1355,7 +1392,7 @@ } /* }}} */ -/* {{{ proto bool deleteIndex(int index) +/* {{{ proto bool deleteIndex(int index) U Delete a file using its index */ ZIPARCHIVE_METHOD(deleteIndex) { @@ -1385,7 +1422,7 @@ } /* }}} */ -/* {{{ proto bool deleteName(string name) +/* {{{ proto bool deleteName(string name) U Delete a file using its index */ ZIPARCHIVE_METHOD(deleteName) { @@ -1401,7 +1438,7 @@ ZIP_FROM_OBJECT(intern, this); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s&", &name, &name_len, UG(ascii_conv)) == FAILURE) { return; } if (name_len < 1) { @@ -1416,7 +1453,7 @@ } /* }}} */ -/* {{{ proto bool renameIndex(int index, string new_name) +/* {{{ proto bool renameIndex(int index, string new_name) U Rename an entry selected by its index to new_name */ ZIPARCHIVE_METHOD(renameIndex) { @@ -1433,7 +1470,8 @@ ZIP_FROM_OBJECT(intern, this); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &index, &new_name, &new_name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls&", &index, + &new_name, &new_name_len, UG(ascii_conv)) == FAILURE) { return; } @@ -1452,7 +1490,7 @@ } /* }}} */ -/* {{{ proto bool renameName(string name, string new_name) +/* {{{ proto bool renameName(string name, string new_name) U Rename an entry selected by its name to new_name */ ZIPARCHIVE_METHOD(renameName) { @@ -1468,7 +1506,9 @@ ZIP_FROM_OBJECT(intern, this); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &name, &name_len, &new_name, &new_name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s&s&", + &name, &name_len, UG(ascii_conv), + &new_name, &new_name_len, UG(ascii_conv)) == FAILURE) { return; } @@ -1486,7 +1526,7 @@ } /* }}} */ -/* {{{ proto bool unchangeIndex(int index) +/* {{{ proto bool unchangeIndex(int index) U Changes to the file at position index are reverted */ ZIPARCHIVE_METHOD(unchangeIndex) { @@ -1516,7 +1556,7 @@ } /* }}} */ -/* {{{ proto bool unchangeName(string name) +/* {{{ proto bool unchangeName(string name) U Changes to the file named 'name' are reverted */ ZIPARCHIVE_METHOD(unchangeName) { @@ -1532,7 +1572,8 @@ ZIP_FROM_OBJECT(intern, this); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s&", + &name, &name_len, UG(ascii_conv)) == FAILURE) { return; } @@ -1550,7 +1591,7 @@ } /* }}} */ -/* {{{ proto bool unchangeAll() +/* {{{ proto bool unchangeAll() U All changes to files and global information in archive are reverted */ ZIPARCHIVE_METHOD(unchangeAll) { @@ -1571,7 +1612,7 @@ } /* }}} */ -/* {{{ proto bool unchangeAll() +/* {{{ proto bool unchangeAll() U Revert all global changes to the archive archive. For now, this only reverts archive comment changes. */ ZIPARCHIVE_METHOD(unchangeArchive) { @@ -1592,7 +1633,7 @@ } /* }}} */ -/* {{{ array bool extractTo(string pathto[, mixed files]) +/* {{{ array bool extractTo(string pathto[, mixed files]) U Extract one or more file from a zip archive */ /* TODO: * - allow index or array of indeces @@ -1607,6 +1648,7 @@ zval *zval_files = NULL; zval **zval_file = NULL; php_stream_statbuf ssb; + zval **pathto_zval; char *pathto; char *file; int pathto_len; @@ -1618,10 +1660,14 @@ RETURN_FALSE; } - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z", &pathto, &pathto_len, &zval_files) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z|z", &pathto_zval, &pathto_len, &zval_files) == FAILURE) { return; } + if (FAILURE == php_stream_path_param_encode(pathto_zval, &pathto, &pathto_len, REPORT_ERRORS, FG(default_context))) { + RETURN_FALSE; + } + if (pathto_len<1) { RETURN_FALSE; } @@ -1637,6 +1683,7 @@ ZIP_FROM_OBJECT(intern, this); if (zval_files) { switch (Z_TYPE_P(zval_files)) { + case IS_UNICODE: case IS_STRING: file = Z_STRVAL_P(zval_files); if (!php_zip_extract_file(intern, pathto, file TSRMLS_CC)) { @@ -1713,7 +1760,8 @@ ZIP_FROM_OBJECT(intern, this); if (type == 1) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ll", &filename, &filename_len, &len, &flags) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s&|ll", + &filename, &filename_len, UG(ascii_conv), &len, &flags) == FAILURE) { return; } PHP_ZIP_STAT_PATH(intern, filename, filename_len, flags, sb); @@ -1753,7 +1801,7 @@ } /* }}} */ -/* {{{ proto resource getFromName(string entryname[, int len [, int flags]]) +/* {{{ proto resource getFromName(string entryname[, int len [, int flags]]) U get the contents of an entry using its name */ ZIPARCHIVE_METHOD(getFromName) { @@ -1761,7 +1809,7 @@ } /* }}} */ -/* {{{ proto resource getFromIndex(string entryname[, int len [, int flags]]) +/* {{{ proto resource getFromIndex(string entryname[, int len [, int flags]]) U get the contents of an entry using its index */ ZIPARCHIVE_METHOD(getFromIndex) { @@ -1788,7 +1836,7 @@ ZIP_FROM_OBJECT(intern, this); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, &filename_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s&", &filename, &filename_len, UG(ascii_conv)) == FAILURE) { return; } @@ -1938,7 +1986,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.22 2006/10/30 23:00:54 pajoye Exp $"); + php_info_print_table_row(2, "Extension Version","$Id: php_zip.c,v 1.23 2006/10/31 14:27:09 pajoye Exp $"); php_info_print_table_row(2, "Zip version", "2.0.0"); php_info_print_table_row(2, "Libzip version", "0.7.1"); http://cvs.php.net/viewvc.cgi/php-src/ext/zip/php_zip.h?r1=1.11&r2=1.12&diff_format=u Index: php-src/ext/zip/php_zip.h diff -u php-src/ext/zip/php_zip.h:1.11 php-src/ext/zip/php_zip.h:1.12 --- php-src/ext/zip/php_zip.h:1.11 Sun Aug 13 20:16:48 2006 +++ php-src/ext/zip/php_zip.h Tue Oct 31 14:27:09 2006 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_zip.h,v 1.11 2006/08/13 20:16:48 pajoye Exp $ */ +/* $Id: php_zip.h,v 1.12 2006/10/31 14:27:09 pajoye Exp $ */ #ifndef PHP_ZIP_H #define PHP_ZIP_H @@ -42,6 +42,13 @@ # endif #endif +#if PHP_MAJOR_VERSION < 6 +#define zend_ascii_hash_find(hash, name, sizeof_name, val) zend_hash_find(hash, name, sizeof_name, val) +#define add_ascii_assoc_long(array, name, val) add_assoc_long(array, name, val) +#define add_ascii_assoc_string(array, name, val, dup) add_assoc_long(array, name, val, dup) + +#endif + typedef struct _ze_zip_rsrc { struct zip *za; int index_current; http://cvs.php.net/viewvc.cgi/php-src/ext/zip/tests/bug38943.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/zip/tests/bug38943.phpt diff -u php-src/ext/zip/tests/bug38943.phpt:1.1 php-src/ext/zip/tests/bug38943.phpt:1.2 --- php-src/ext/zip/tests/bug38943.phpt:1.1 Mon Sep 25 09:17:56 2006 +++ php-src/ext/zip/tests/bug38943.phpt Tue Oct 31 14:27:09 2006 @@ -2,7 +2,7 @@ #38943, properties in extended class cannot be set --SKIPIF-- <?php -/* $Id: bug38943.phpt,v 1.1 2006/09/25 09:17:56 pajoye Exp $ */ +/* $Id: bug38943.phpt,v 1.2 2006/10/31 14:27:09 pajoye Exp $ */ if(!extension_loaded('zip')) die('skip'); ?> --FILE-- @@ -48,3 +48,29 @@ ["comment"]=> string(0) "" } +--UEXPECTF-- +array(1) { + [0]=> + int(1) +} +object(myZip)#1 (8) { + [u"test":u"myZip":private]=> + int(0) + [u"testp"]=> + unicode(6) "foobar" + [u"testarray":u"myZip":private]=> + array(1) { + [0]=> + int(1) + } + [u"status"]=> + int(0) + [u"statusSys"]=> + int(0) + [u"numFiles"]=> + int(0) + [u"filename"]=> + string(0) "" + [u"comment"]=> + string(0) "" +} http://cvs.php.net/viewvc.cgi/php-src/ext/zip/tests/bug38944.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/zip/tests/bug38944.phpt diff -u php-src/ext/zip/tests/bug38944.phpt:1.1 php-src/ext/zip/tests/bug38944.phpt:1.2 --- php-src/ext/zip/tests/bug38944.phpt:1.1 Mon Sep 25 08:44:58 2006 +++ php-src/ext/zip/tests/bug38944.phpt Tue Oct 31 14:27:09 2006 @@ -38,3 +38,22 @@ string(0) "" } Done +--UEXPECTF-- +int(0) +int(0) +int(0) +string(0) "" +string(0) "" +object(ZipArchive)#1 (5) { + [u"status"]=> + int(0) + [u"statusSys"]=> + int(0) + [u"numFiles"]=> + int(0) + [u"filename"]=> + string(0) "" + [u"comment"]=> + string(0) "" +} +Done http://cvs.php.net/viewvc.cgi/php-src/ext/zip/tests/oo_extract.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/zip/tests/oo_extract.phpt diff -u php-src/ext/zip/tests/oo_extract.phpt:1.1 php-src/ext/zip/tests/oo_extract.phpt:1.2 --- php-src/ext/zip/tests/oo_extract.phpt:1.1 Mon Oct 30 17:43:21 2006 +++ php-src/ext/zip/tests/oo_extract.phpt Tue Oct 31 14:27:09 2006 @@ -2,7 +2,7 @@ extractTo --SKIPIF-- <?php -/* $Id: oo_extract.phpt,v 1.1 2006/10/30 17:43:21 pajoye Exp $ */ +/* $Id: oo_extract.phpt,v 1.2 2006/10/31 14:27:09 pajoye Exp $ */ if(!extension_loaded('zip')) die('skip'); ?> --FILE-- @@ -11,11 +11,11 @@ $file = $dirname . 'test_with_comment.zip'; include $dirname . 'utils.inc'; $zip = new ZipArchive; -if (!$zip->open($file)) { +if ($zip->open($file) !== TRUE) { + echo "open failed.\n"; exit('failed'); } - $zip->extractTo($dirname . '__oo_extract_tmp'); if (!is_dir($dirname . '__oo_extract_tmp')) { echo "failed. mkdir\n"; @@ -26,7 +26,7 @@ } if (!file_exists($dirname . '__oo_extract_tmp/foobar/baz')) { - echo "failed. mkdir foobar\n"; + echo "failed. extract foobar/baz\n"; } else { echo file_get_contents($dirname . '__oo_extract_tmp/foobar/baz') . "\n"; } @@ -80,3 +80,16 @@ bar foo +--UEXPECTF-- +blabla laber rababer sülz + +bar + +foo + + +bar + +bar + +foo
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php