Closed
Description
Description
There is a problem with ZipArchive deleting empty archives without notice upon successful close. And statcache not updated.
<?php
$tmp_file = tempnam(sys_get_temp_dir(), '');
var_dump(is_file($tmp_file)); // returns true
$zip = new ZipArchive;
$zip->open($tmp_file, ZipArchive::OVERWRITE);
$zip->close(); // returns true
var_dump(is_file($tmp_file)); // returns true
var_dump(file_get_contents($tmp_file)); // returns error file does not exist
I expected the defined file to remain. If I can't count on that I expected the statcache to be updated.
PHP Version
PHP 8.1.6
Operating System
Windows 11 x64