mirror of
https://github.com/php/php-src.git
synced 2025-08-16 14:08:47 +02:00
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0: NEWS Fix GH-8781 ZipArchive::close deletes zip file without updating stat cache
This commit is contained in:
commit
c76374d26f
2 changed files with 24 additions and 0 deletions
|
@ -1571,6 +1571,9 @@ PHP_METHOD(ZipArchive, close)
|
|||
ze_obj->err_sys = 0;
|
||||
}
|
||||
|
||||
/* clear cache as empty zip are not created but deleted */
|
||||
php_clear_stat_cache(1, ze_obj->filename, ze_obj->filename_len);
|
||||
|
||||
efree(ze_obj->filename);
|
||||
ze_obj->filename = NULL;
|
||||
ze_obj->filename_len = 0;
|
||||
|
|
21
ext/zip/tests/bug_gh8781.phpt
Normal file
21
ext/zip/tests/bug_gh8781.phpt
Normal file
|
@ -0,0 +1,21 @@
|
|||
--TEST--
|
||||
Bug GH-8781 (ZipArchive deletes zip file with no contents)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('zip')) die('skip zip extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
touch($file = __DIR__ . '/bug_gh8781.zip');
|
||||
var_dump(is_file($file));
|
||||
|
||||
$zip = new ZipArchive();
|
||||
$zip->open($file, ZipArchive::CREATE | ZipArchive::OVERWRITE);
|
||||
$zip->close();
|
||||
|
||||
var_dump(is_file($file));
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(false)
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue