[php-src] Issue #8781: ZipArchive deletes zip file with no contents and doesn't update stat cache
| From: | timint | Date: | Tue, 14 Jun 2022 21:36:13 +0000 |
| Subject: | [php-src] Issue #8781: ZipArchive deletes zip file with no contents and doesn't update stat cache | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-241734@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/8781
Author: timint
### Description
There is a problem with ZipArchive deleting empty archives without notice upon successful close.
And statcache not updated.
```php
<?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.16
### Operating System
Windows 11 x64