#48048 [Opn->Fbk]: Empty files corrupt zip
| From: | jani@php.net | Date: | Sat, 25 Apr 2009 16:07:18 +0000 |
| Subject: | #48048 [Opn->Fbk]: Empty files corrupt zip | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-136305@lists.php.net to get a copy of this message | ||
ID: 48048
Updated by: jani@php.net
Reported By: php at codecaster dot nl
-Status: Open
+Status: Feedback
Bug Type: Zip Related
Operating System: FreeBSD 7
PHP Version: 5.2.9
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
I can't reproduce this with latest CVS checkout of PHP_5_2.
Previous Comments:
------------------------------------------------------------------------
[2009-04-22 14:38:46] php at codecaster dot nl
Description:
------------
When you use ZipArchive->addFile() on an empty file, the file will be
compressed anyway. This is incorrectly read by some (older)
decompression programs.
Reproduce code:
---------------
if (file_put_contents("empty.txt", "") === false) {
die("Cannot write files");
}
$zip = new ZipArchive();
$zip->open("corrupt.zip", ZIPARCHIVE::CREATE);
$zip->addFile("empty.txt");
$zip->close();
Expected result:
----------------
A zip file containing empty.txt with a size of 0 bytes and a compressed
size of 0 bytes.
Actual result:
--------------
A zip file containing empty.txt with a size of 0 bytes and a compressed
size of 2 bytes.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=48048&edit=1