Skip to content

Commit 3c27461

Browse files
committed
Fixed bug #73119 Wrong return for ZipArchive::addEmptyDir Method
1 parent 27fb0b2 commit 3c27461

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
@@ -1626,11 +1626,12 @@ static ZIPARCHIVE_METHOD(addEmptyDir)
16261626
if (idx >= 0) {
16271627
RETVAL_FALSE;
16281628
} else {
1629-
if (zip_add_dir(intern, (const char *)s) == -1) {
1629+
if (zip_dir_add(intern, (const char *)s, 0) == -1) {
16301630
RETVAL_FALSE;
1631+
} else {
1632+
zip_error_clear(intern);
1633+
RETVAL_TRUE;
16311634
}
1632-
zip_error_clear(intern);
1633-
RETVAL_TRUE;
16341635
}
16351636

16361637
if (s != dirname) {
@@ -3044,6 +3045,9 @@ static PHP_MINIT_FUNCTION(zip)
30443045
REGISTER_ZIP_CLASS_CONST_LONG("EXCL", ZIP_EXCL);
30453046
REGISTER_ZIP_CLASS_CONST_LONG("CHECKCONS", ZIP_CHECKCONS);
30463047
REGISTER_ZIP_CLASS_CONST_LONG("OVERWRITE", ZIP_OVERWRITE);
3048+
#ifdef ZIP_RDONLY
3049+
REGISTER_ZIP_CLASS_CONST_LONG("RDONLY", ZIP_RDONLY);
3050+
#endif
30473051

30483052
REGISTER_ZIP_CLASS_CONST_LONG("FL_NOCASE", ZIP_FL_NOCASE);
30493053
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)