Fixed bug #73119 Wrong return for ZipArchive::addEmptyDir Method

This commit is contained in:
Remi Collet 2020-02-03 10:06:44 +01:00 committed by Remi Collet
parent aaf9cbb7eb
commit 0bc19a4b81
2 changed files with 7 additions and 3 deletions

View File

@ -1626,11 +1626,12 @@ static ZIPARCHIVE_METHOD(addEmptyDir)
if (idx >= 0) { if (idx >= 0) {
RETVAL_FALSE; RETVAL_FALSE;
} else { } else {
if (zip_add_dir(intern, (const char *)s) == -1) { if (zip_dir_add(intern, (const char *)s, 0) == -1) {
RETVAL_FALSE; RETVAL_FALSE;
} else {
zip_error_clear(intern);
RETVAL_TRUE;
} }
zip_error_clear(intern);
RETVAL_TRUE;
} }
if (s != dirname) { if (s != dirname) {
@ -3044,6 +3045,9 @@ static PHP_MINIT_FUNCTION(zip)
REGISTER_ZIP_CLASS_CONST_LONG("EXCL", ZIP_EXCL); REGISTER_ZIP_CLASS_CONST_LONG("EXCL", ZIP_EXCL);
REGISTER_ZIP_CLASS_CONST_LONG("CHECKCONS", ZIP_CHECKCONS); REGISTER_ZIP_CLASS_CONST_LONG("CHECKCONS", ZIP_CHECKCONS);
REGISTER_ZIP_CLASS_CONST_LONG("OVERWRITE", ZIP_OVERWRITE); REGISTER_ZIP_CLASS_CONST_LONG("OVERWRITE", ZIP_OVERWRITE);
#ifdef ZIP_RDONLY
REGISTER_ZIP_CLASS_CONST_LONG("RDONLY", ZIP_RDONLY);
#endif
REGISTER_ZIP_CLASS_CONST_LONG("FL_NOCASE", ZIP_FL_NOCASE); REGISTER_ZIP_CLASS_CONST_LONG("FL_NOCASE", ZIP_FL_NOCASE);
REGISTER_ZIP_CLASS_CONST_LONG("FL_NODIR", ZIP_FL_NODIR); REGISTER_ZIP_CLASS_CONST_LONG("FL_NODIR", ZIP_FL_NODIR);

Binary file not shown.