mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3: NEWS Fix Bug #79296 ZipArchive::open fails on empty file
This commit is contained in:
commit
98687abb1d
1 changed files with 15 additions and 0 deletions
|
@ -1472,6 +1472,21 @@ static ZIPARCHIVE_METHOD(open)
|
|||
ze_obj->filename = NULL;
|
||||
}
|
||||
|
||||
#if LIBZIP_VERSION_MAJOR > 1 || LIBZIP_VERSION_MAJOR == 1 && LIBZIP_VERSION_MINOR >= 6
|
||||
/* reduce BC break introduce in libzip 1.6.0
|
||||
"Do not accept empty files as valid zip archives any longer" */
|
||||
|
||||
/* open for write without option to empty the archive */
|
||||
if ((flags & (ZIP_TRUNCATE | ZIP_RDONLY)) == 0) {
|
||||
zend_stat_t st;
|
||||
|
||||
/* exists and is empty */
|
||||
if (VCWD_STAT(resolved_path, &st) == 0 && st.st_size == 0) {
|
||||
flags |= ZIP_TRUNCATE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
intern = zip_open(resolved_path, flags, &err);
|
||||
if (!intern || err) {
|
||||
efree(resolved_path);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue