[php-src] Issue #7801: When a zip file is left empty, a warning is triggered when script end

From: Date: Mon, 20 Dec 2021 10:29:26 +0000
Subject: [php-src] Issue #7801: When a zip file is left empty, a warning is triggered when script end
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-238510@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/7801 Author: marcomarsala ### Description The following code: ```php <?php $zip = new ZipArchive(); $out = "test.zip"; $zip->open($out, ZipArchive::CREATE | ZipArchive::OVERWRITE); ?> ``` Resulted in this warning: ``` PHP Warning: Unknown: Cannot destroy the zip context: Can't remove file: No such file or directory in Unknown on line 0 ``` But I expected no warnings. This does not happen if flag ZipArchive::OVERWRITE is not specified. I guess ZipArchive has a registered shutdown function to clear temp zip file when script ends, but that file is created when the first file is added. ### PHP Version n/a ### Operating System Ubuntu 16.04

« previous php.bugs (#238510) next »