zip extension version 1.22.1

- add ZipArchive::FL_OPEN_FILE_NOW to open the file when added
  instead of waiting for archive to be closed
This commit is contained in:
Remi Collet 2023-06-29 15:21:15 +02:00
parent 071bf46573
commit b406f7c67a
No known key found for this signature in database
GPG key ID: DC9FF8D3EE5AF27F
6 changed files with 53 additions and 4 deletions

View file

@ -299,7 +299,17 @@ static int php_zip_add_file(ze_zip_object *obj, const char *filename, size_t fil
return -1;
}
zs = zip_source_file(obj->za, resolved_path, offset_start, offset_len);
if (flags & ZIP_FL_OPEN_FILE_NOW) {
FILE *fd;
fd = fopen(resolved_path, "rb");
if (!fd) {
return -1;
}
flags ^= ZIP_FL_OPEN_FILE_NOW;
zs = zip_source_filep(obj->za, fd, offset_start, offset_len);
} else {
zs = zip_source_file(obj->za, resolved_path, offset_start, offset_len);
}
if (!zs) {
return -1;
}