[php-src] Issue #7801: When a zip file is left empty, a warning is triggered when script end
| From: | cmb69 | Date: | Tue, 21 Dec 2021 17:30:25 +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-238519@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/7801
Comment Author: cmb69
Neither Apache nor a browser involved here. This issue is not SAPI specifc.
The
ZipArchive::OVERWRITE flag [is actually
ZIP_TRUNCATE](https://github.com/php/php-src/blob/PHP-8.0/ext/zip/php_zip.h#L30-L32).
This flag causes an attempt to delete the archive, but of course that fails if the file does not
exist. Prior to libzip 1.6.0, this was reported as the error you're experiencing. This bug has
been fixed with https://github.com/nih-at/libzip/commit/23b25a8d69a8b90c08e1923e674e2ff654af5575.
I don't think it makes sense for PHP to try to work around that bug, since that can be done in
userland as well (just don't open non-existing archives with
ZipArchive::OVERWRITE), and the bug has been fixed upstream. And of course, you could
just ignore this warning.