Skip to content

Commit 5eb9cff

Browse files
committed
Merge branch 'PHP-7.4'
* PHP-7.4: NEWS Fixed bug #73119 Wrong return for ZipArchive::addEmptyDir Method
2 parents 98a8ab1 + 3375cfe commit 5eb9cff

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

ext/zip/php_zip.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1581,11 +1581,12 @@ static ZIPARCHIVE_METHOD(addEmptyDir)
15811581
if (idx >= 0) {
15821582
RETVAL_FALSE;
15831583
} else {
1584-
if (zip_add_dir(intern, (const char *)s) == -1) {
1584+
if (zip_dir_add(intern, (const char *)s, 0) == -1) {
15851585
RETVAL_FALSE;
1586+
} else {
1587+
zip_error_clear(intern);
1588+
RETVAL_TRUE;
15861589
}
1587-
zip_error_clear(intern);
1588-
RETVAL_TRUE;
15891590
}
15901591

15911592
if (s != dirname) {
@@ -3020,6 +3021,9 @@ static PHP_MINIT_FUNCTION(zip)
30203021
REGISTER_ZIP_CLASS_CONST_LONG("EXCL", ZIP_EXCL);
30213022
REGISTER_ZIP_CLASS_CONST_LONG("CHECKCONS", ZIP_CHECKCONS);
30223023
REGISTER_ZIP_CLASS_CONST_LONG("OVERWRITE", ZIP_OVERWRITE);
3024+
#ifdef ZIP_RDONLY
3025+
REGISTER_ZIP_CLASS_CONST_LONG("RDONLY", ZIP_RDONLY);
3026+
#endif
30233027

30243028
REGISTER_ZIP_CLASS_CONST_LONG("FL_NOCASE", ZIP_FL_NOCASE);
30253029
REGISTER_ZIP_CLASS_CONST_LONG("FL_NODIR", ZIP_FL_NODIR);

ext/zip/tests/oo_namelocate.zip

344 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)