[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/NEWS branches/PHP_5_3/ext/zip/php_zip.c trunk/ext/zip/php_zip.c

2011-02-04 Thread Adam Harvey
aharvey  Fri, 04 Feb 2011 10:50:42 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=308014

Log:
Fix bug #53923 (Zip functions assume HAVE_GLOB is defined).

Bug: http://bugs.php.net/53923 (Assigned) Zip functions assume HAVE_GLOB is 
defined
  
Changed paths:
U   php/php-src/branches/PHP_5_3/NEWS
U   php/php-src/branches/PHP_5_3/ext/zip/php_zip.c
U   php/php-src/trunk/ext/zip/php_zip.c

Modified: php/php-src/branches/PHP_5_3/NEWS
===
--- php/php-src/branches/PHP_5_3/NEWS   2011-02-04 10:49:49 UTC (rev 308013)
+++ php/php-src/branches/PHP_5_3/NEWS   2011-02-04 10:50:42 UTC (rev 308014)
@@ -157,6 +157,7 @@

 - Zip extension:
   . Added the filename into the return value of stream_get_meta_data(). 
(Hannes)
+  . Fixed bug #53923 (Zip functions assume HAVE_GLOB is defined). (Adam)
   . Fixed bug #53166 (Missing parameters in docs and reflection definition).
 (Richard)
   . Fixed bug #53568 (swapped memset arguments in struct initialization).

Modified: php/php-src/branches/PHP_5_3/ext/zip/php_zip.c
===
--- php/php-src/branches/PHP_5_3/ext/zip/php_zip.c  2011-02-04 10:49:49 UTC 
(rev 308013)
+++ php/php-src/branches/PHP_5_3/ext/zip/php_zip.c  2011-02-04 10:50:42 UTC 
(rev 308014)
@@ -565,6 +565,7 @@
return globbuf.gl_pathc;
 }
 /* }}} */
+#endif /* HAVE_GLOB */

 int php_zip_pcre(char *regexp, int regexp_len, char *path, int path_len, zval 
*return_value TSRMLS_DC) /* {{{ */
 {
@@ -666,8 +667,6 @@
 /* }}} */
 #endif

-#endif
-
 /* {{{ arginfo */
 ZEND_BEGIN_ARG_INFO_EX(arginfo_zip_open, 0, 0, 1)
ZEND_ARG_INFO(0, filename)
@@ -1592,9 +1591,11 @@
char *add_path = NULL;
int pattern_len, add_path_len, remove_path_len, path_len = 0;
long remove_all_path = 0;
-   long flags = 0;
zval *options = NULL;
int found;
+#ifdef HAVE_GLOB
+   long flags = 0;
+#endif

if (!this) {
RETURN_FALSE;
@@ -1603,10 +1604,15 @@
ZIP_FROM_OBJECT(intern, this);
/* 1 == glob, 2==pcre */
if (type == 1) {
+#ifdef HAVE_GLOB
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s|la,
pattern, pattern_len, flags, 
options) == FAILURE) {
return;
}
+#else
+   php_error_docref(NULL TSRMLS_CC, E_ERROR, Glob support is not 
available);
+   RETURN_FALSE;
+#endif
} else {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s|sa,
pattern, pattern_len, path, 
path_len, options) == FAILURE) {
@@ -1629,7 +1635,9 @@
}

if (type == 1) {
+#ifdef HAVE_GLOB
found = php_zip_glob(pattern, pattern_len, flags, return_value 
TSRMLS_CC);
+#endif
} else {
found = php_zip_pcre(pattern, pattern_len, path, path_len, 
return_value TSRMLS_CC);
}
@@ -1688,6 +1696,7 @@
 }
 /* }}} */

+#ifdef HAVE_GLOB
 /* {{{ proto bool ZipArchive::addGlob(string pattern[,int flags [, array 
options]])
 Add files matching the glob pattern. See php's glob for the pattern syntax. */
 static ZIPARCHIVE_METHOD(addGlob)
@@ -1695,6 +1704,7 @@
php_zip_add_from_pattern(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
 }
 /* }}} */
+#endif

 /* {{{ proto bool ZipArchive::addPattern(string pattern[, string path [, array 
options]])
 Add files matching the pcre pattern. See php's pcre for the pattern syntax. */
@@ -2570,11 +2580,13 @@
ZEND_ARG_INFO(0, dirname)
 ZEND_END_ARG_INFO()

+#ifdef HAVE_GLOB
 ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_addglob, 0, 0, 1)
ZEND_ARG_INFO(0, pattern)
ZEND_ARG_INFO(0, flags)
ZEND_ARG_INFO(0, options)
 ZEND_END_ARG_INFO()
+#endif

 ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_addpattern, 0, 0, 1)
ZEND_ARG_INFO(0, pattern)
@@ -2680,7 +2692,9 @@
ZIPARCHIVE_ME(addEmptyDir,  
arginfo_ziparchive_addemptydir, ZEND_ACC_PUBLIC)
ZIPARCHIVE_ME(addFromString,
arginfo_ziparchive_addfromstring, ZEND_ACC_PUBLIC)
ZIPARCHIVE_ME(addFile,  
arginfo_ziparchive_addfile, ZEND_ACC_PUBLIC)
+#ifdef HAVE_GLOB
ZIPARCHIVE_ME(addGlob,  
arginfo_ziparchive_addglob, ZEND_ACC_PUBLIC)
+#endif
ZIPARCHIVE_ME(addPattern,   
arginfo_ziparchive_addpattern, ZEND_ACC_PUBLIC)
ZIPARCHIVE_ME(renameIndex,  
arginfo_ziparchive_renameindex, ZEND_ACC_PUBLIC)
ZIPARCHIVE_ME(renameName,   
arginfo_ziparchive_renamename, ZEND_ACC_PUBLIC)

Modified: php/php-src/trunk/ext/zip/php_zip.c
===
--- php/php-src/trunk/ext/zip/php_zip.c 2011-02-04 10:49:49 UTC (rev 308013)
+++ 

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/NEWS branches/PHP_5_3/ext/zip/php_zip.c trunk/ext/zip/php_zip.c

2011-01-27 Thread Pierre Joye
pajoye   Thu, 27 Jan 2011 11:47:24 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=307778

Log:
- Fix bug #53166,  missing parameters in reflections/docs

Bug: http://bugs.php.net/53166 (Assigned) ZipArchive::addFile() is missing 
parameters in docs
  
Changed paths:
U   php/php-src/branches/PHP_5_3/NEWS
U   php/php-src/branches/PHP_5_3/ext/zip/php_zip.c
U   php/php-src/trunk/ext/zip/php_zip.c

Modified: php/php-src/branches/PHP_5_3/NEWS
===
--- php/php-src/branches/PHP_5_3/NEWS	2011-01-27 09:57:01 UTC (rev 30)
+++ php/php-src/branches/PHP_5_3/NEWS	2011-01-27 11:47:24 UTC (rev 307778)
@@ -144,6 +144,8 @@
 (Hannes)
   . Fixed bug #53603 (ZipArchive should quiet stat errors). (brad dot froehle at
 gmail dot com, Gustavo)
+  . Fixed bzg #53166 (Missing parameters in docs and reflection definition).
+(Richard)

 06 Jan 2011, PHP 5.3.5
 - Fixed Bug #53632 (infinite loop with x87 fpu). (CVE-2010-4645) (Scott,

Modified: php/php-src/branches/PHP_5_3/ext/zip/php_zip.c
===
--- php/php-src/branches/PHP_5_3/ext/zip/php_zip.c	2011-01-27 09:57:01 UTC (rev 30)
+++ php/php-src/branches/PHP_5_3/ext/zip/php_zip.c	2011-01-27 11:47:24 UTC (rev 307778)
@@ -1688,7 +1688,7 @@
 }
 /* }}} */

-/* {{{ proto bool addGlob(string pattern[,int flags [, array options]])
+/* {{{ proto bool ZipArchive::addGlob(string pattern[,int flags [, array options]])
 Add files matching the glob pattern. See php's glob for the pattern syntax. */
 static ZIPARCHIVE_METHOD(addGlob)
 {
@@ -1696,7 +1696,7 @@
 }
 /* }}} */

-/* {{{ proto bool addPattern(string pattern[, string path [, array options]])
+/* {{{ proto bool ZipArchive::addPattern(string pattern[, string path [, array options]])
 Add files matching the pcre pattern. See php's pcre for the pattern syntax. */
 static ZIPARCHIVE_METHOD(addPattern)
 {
@@ -1925,7 +1925,7 @@
 }
 /* }}} */

-/* {{{ proto bool ZipArchive::setArchiveComment(string name, string comment)
+/* {{{ proto bool ZipArchive::setArchiveComment(string comment)
 Set or remove (NULL/'') the comment of the archive */
 static ZIPARCHIVE_METHOD(setArchiveComment)
 {
@@ -1951,7 +1951,7 @@
 }
 /* }}} */

-/* {{{ proto string ZipArchive::getArchiveComment()
+/* {{{ proto string ZipArchive::getArchiveComment([int flags])
 Returns the comment of an entry using its index */
 static ZIPARCHIVE_METHOD(getArchiveComment)
 {
@@ -2039,7 +2039,7 @@
 }
 /* }}} */

-/* {{{ proto string ZipArchive::getCommentName(string name)
+/* {{{ proto string ZipArchive::getCommentName(string name[, int flags])
 Returns the comment of an entry using its name */
 static ZIPARCHIVE_METHOD(getCommentName)
 {
@@ -2076,7 +2076,7 @@
 }
 /* }}} */

-/* {{{ proto string ZipArchive::getCommentIndex(int index)
+/* {{{ proto string ZipArchive::getCommentIndex(int index[, int flags])
 Returns the comment of an entry using its index */
 static ZIPARCHIVE_METHOD(getCommentIndex)
 {
@@ -2559,7 +2559,7 @@

 /* {{{ arginfo */
 ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_open, 0, 0, 1)
-	ZEND_ARG_INFO(0, source)
+	ZEND_ARG_INFO(0, filename)
 	ZEND_ARG_INFO(0, flags)
 ZEND_END_ARG_INFO()

@@ -2604,8 +2604,7 @@
 	ZEND_ARG_INFO(0, flags)
 ZEND_END_ARG_INFO()

-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_setarchivecomment, 0, 0, 2)
-	ZEND_ARG_INFO(0, name)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_setarchivecomment, 0, 0, 1)
 	ZEND_ARG_INFO(0, comment)
 ZEND_END_ARG_INFO()

@@ -2616,10 +2615,12 @@

 ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_getcommentname, 0, 0, 1)
 	ZEND_ARG_INFO(0, name)
+	ZEND_ARG_INFO(0, flags)
 ZEND_END_ARG_INFO()

 ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_getcommentindex, 0, 0, 1)
 	ZEND_ARG_INFO(0, index)
+	ZEND_ARG_INFO(0, flags)
 ZEND_END_ARG_INFO()

 ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_renameindex, 0, 0, 2)
@@ -2657,6 +2658,15 @@
 	ZEND_ARG_INFO(0, flags)
 ZEND_END_ARG_INFO()

+ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_getarchivecomment, 0, 0, 0)
+	ZEND_ARG_INFO(0, flags)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_setcommentname, 0, 0, 2)
+	ZEND_ARG_INFO(0, name)
+	ZEND_ARG_INFO(0, comment)
+ZEND_END_ARG_INFO()
+
 ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_getstream, 0, 0, 1)
 	ZEND_ARG_INFO(0, entryname)
 ZEND_END_ARG_INFO()
@@ -2675,21 +2685,21 @@
 	ZIPARCHIVE_ME(renameIndex,			arginfo_ziparchive_renameindex, ZEND_ACC_PUBLIC)
 	ZIPARCHIVE_ME(renameName,			arginfo_ziparchive_renamename, ZEND_ACC_PUBLIC)
 	ZIPARCHIVE_ME(setArchiveComment,	arginfo_ziparchive_setarchivecomment, ZEND_ACC_PUBLIC)
-	ZIPARCHIVE_ME(getArchiveComment,	arginfo_ziparchive__void, ZEND_ACC_PUBLIC)
+	ZIPARCHIVE_ME(getArchiveComment,	arginfo_ziparchive_getarchivecomment, ZEND_ACC_PUBLIC)
 	ZIPARCHIVE_ME(setCommentIndex,		arginfo_ziparchive_setcommentindex, ZEND_ACC_PUBLIC)
-	ZIPARCHIVE_ME(setCommentName,		arginfo_ziparchive_setarchivecomment,