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 @@ -1480,6 +1480,21 @@ static ZIPARCHIVE_METHOD(open)
1480
1480
ze_obj -> filename = NULL ;
1481
1481
}
1482
1482
1483
+ #if LIBZIP_VERSION_MAJOR > 1 || LIBZIP_VERSION_MAJOR == 1 && LIBZIP_VERSION_MINOR >= 6
1484
+ /* reduce BC break introduce in libzip 1.6.0
1485
+ "Do not accept empty files as valid zip archives any longer" */
1486
+
1487
+ /* open for write without option to empty the archive */
1488
+ if ((flags & (ZIP_TRUNCATE | ZIP_RDONLY )) == 0 ) {
1489
+ zend_stat_t st ;
1490
+
1491
+ /* exists and is empty */
1492
+ if (VCWD_STAT (resolved_path , & st ) == 0 && st .st_size == 0 ) {
1493
+ flags |= ZIP_TRUNCATE ;
1494
+ }
1495
+ }
1496
+ #endif
1497
+
1483
1498
intern = zip_open (resolved_path , flags , & err );
1484
1499
if (!intern || err ) {
1485
1500
efree (resolved_path );
You can’t perform that action at this time.
0 commit comments