summaryrefslogtreecommitdiff
path: root/ext/zip/php_zip.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/zip/php_zip.c')
-rw-r--r--ext/zip/php_zip.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c
index 27f0bb2dd7..0e46345f7a 100644
--- a/ext/zip/php_zip.c
+++ b/ext/zip/php_zip.c
@@ -1153,6 +1153,7 @@ ZIPARCHIVE_METHOD(locateName)
char *name;
int name_len;
long flags = 0;
+ long idx = -1;
if (!this) {
RETURN_FALSE;
@@ -1169,7 +1170,18 @@ ZIPARCHIVE_METHOD(locateName)
RETURN_FALSE;
}
- RETURN_LONG((long)zip_name_locate(intern, (const char *)name, flags))
+ idx = (long)zip_name_locate(intern, (const char *)name, flags);
+
+ if (idx<0) {
+ /* reset the error */
+ if (intern->error.str) {
+ _zip_error_fini(&intern->error);
+ }
+ _zip_error_init(&intern->error);
+ RETURN_FALSE;
+ } else {
+ RETURN_LONG(idx);
+ }
}
/* }}} */