mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
- MFH: locateName should not change the state/error, can be used to test
an entry
This commit is contained in:
parent
8d07735332
commit
284ce40c4a
2 changed files with 22 additions and 9 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue