File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -1472,6 +1472,21 @@ static ZIPARCHIVE_METHOD(open)
1472
1472
ze_obj -> filename = NULL ;
1473
1473
}
1474
1474
1475
+ #if LIBZIP_VERSION_MAJOR > 1 || LIBZIP_VERSION_MAJOR == 1 && LIBZIP_VERSION_MINOR >= 6
1476
+ /* reduce BC break introduce in libzip 1.6.0
1477
+ "Do not accept empty files as valid zip archives any longer" */
1478
+
1479
+ /* open for write without option to empty the archive */
1480
+ if ((flags & (ZIP_TRUNCATE | ZIP_RDONLY )) == 0 ) {
1481
+ zend_stat_t st ;
1482
+
1483
+ /* exists and is empty */
1484
+ if (VCWD_STAT (resolved_path , & st ) == 0 && st .st_size == 0 ) {
1485
+ flags |= ZIP_TRUNCATE ;
1486
+ }
1487
+ }
1488
+ #endif
1489
+
1475
1490
intern = zip_open (resolved_path , flags , & err );
1476
1491
if (!intern || err ) {
1477
1492
efree (resolved_path );
You can’t perform that action at this time.
0 commit comments