Bug #79296 [Com]: ZipArchive::open fails on empty file (libzip 1.6.0)

From: Date: Fri, 20 Mar 2020 10:39:44 +0000
Subject: Bug #79296 [Com]: ZipArchive::open fails on empty file (libzip 1.6.0)
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-226187@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79296&edit=1

 ID:                 79296
 Comment by:         remi@php.net
 Reported by:        dunglas at gmail dot com
 Summary:            ZipArchive::open fails on empty file (libzip 1.6.0)
 Status:             Closed
 Type:               Bug
 Package:            Zip Related
 Operating System:   Mac OS X
 PHP Version:        7.4.3
 Block user comment: N
 Private report:     N

 New Comment:

NOTICE: the workaround implemented for this issue is only valid for PHP 7.3 and 7.4

PHP 8.0 will raise a deprecation warning

PHP 9.0 will follow libzip default behavior


Previous Comments:
------------------------------------------------------------------------
[2020-03-20 10:19:10] remi@php.net

Automatic comment on behalf of remi@remirepo.net
Revision: http://git.php.net/?p=php-src.git;a=commit;h=8aab43c85d67fc1c1935f91bc64db800c4ef4754
Log: Fix Bug #79296 ZipArchive::open fails on empty file

------------------------------------------------------------------------
[2020-03-19 16:39:02] remi@php.net

BTW, if I still don't know if we should fixed this issue, a possible mitigation is proposed in
linked PR.

------------------------------------------------------------------------
[2020-03-19 16:38:08] remi@php.net

The following pull request has been associated:

Patch Name: Fix Bug #79296 ZipArchive::open fails on empty file
On GitHub:  https://github.com/php/php-src/pull/5281
Patch:      https://github.com/php/php-src/pull/5281.patch

------------------------------------------------------------------------
[2020-03-19 13:30:12] remi@php.net

This is not a change in PHP nor ZIP extension, but in libzip 1.6.0, from Changelog

* Do not accept empty files as valid zip archives any longer.


So indeed your code have to be adapted.


I propose to close as "not a bug"

------------------------------------------------------------------------
[2020-03-10 15:20:59] dv dot sum0 at gmail dot com

We saw the same issue on a Centos 7 machine, changed between 7.4.2 and 7.4.3

It seems to be caused by the fact that the tempnam() function creates an empty file immediately, if
you use a different filename that doesn't already exist it works as expected.

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=79296


--
Edit this bug report at https://bugs.php.net/bug.php?id=79296&edit=1


Thread (8 messages)

« previous php.bugs (#226187) next »