summaryrefslogtreecommitdiff
path: root/ext/zip
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2020-02-03 10:06:44 +0100
committerRemi Collet <remi@php.net>2020-02-03 10:10:17 +0100
commit3c274613dc76007f5227aa162e02d5943b683d37 (patch)
tree671b33fc328a8a4e491241c5485325f411f3984e /ext/zip
parent27fb0b28dd7cdd060e47e9c0a8c274be62ddba17 (diff)
downloadphp-git-3c274613dc76007f5227aa162e02d5943b683d37.tar.gz
Fixed bug #73119 Wrong return for ZipArchive::addEmptyDir Method
Diffstat (limited to 'ext/zip')
-rw-r--r--ext/zip/php_zip.c10
-rw-r--r--ext/zip/tests/oo_namelocate.zipbin0 -> 344 bytes
2 files changed, 7 insertions, 3 deletions
diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c
index c6ce639b88..22f9895ad8 100644
--- a/ext/zip/php_zip.c
+++ b/ext/zip/php_zip.c
@@ -1626,11 +1626,12 @@ static ZIPARCHIVE_METHOD(addEmptyDir)
if (idx >= 0) {
RETVAL_FALSE;
} else {
- if (zip_add_dir(intern, (const char *)s) == -1) {
+ if (zip_dir_add(intern, (const char *)s, 0) == -1) {
RETVAL_FALSE;
+ } else {
+ zip_error_clear(intern);
+ RETVAL_TRUE;
}
- zip_error_clear(intern);
- RETVAL_TRUE;
}
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("CHECKCONS", ZIP_CHECKCONS);
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_NODIR", ZIP_FL_NODIR);
diff --git a/ext/zip/tests/oo_namelocate.zip b/ext/zip/tests/oo_namelocate.zip
new file mode 100644
index 0000000000..9754e4c7bf
--- /dev/null
+++ b/ext/zip/tests/oo_namelocate.zip
Binary files differ