#41456 [Opn->Asn]: Cannot decompress newly added files
| From: | tony2001@php.net | Date: | Mon, 21 May 2007 18:57:26 +0000 |
| Subject: | #41456 [Opn->Asn]: Cannot decompress newly added files | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-112915@lists.php.net to get a copy of this message | ||
ID: 41456
Updated by: tony2001@php.net
Reported By: sander dot marechal at tribal dot nl
-Status: Open
+Status: Assigned
Bug Type: Zip Related
Operating System: Linux
PHP Version: 5.2.2
-Assigned To:
+Assigned To: pajoye
Previous Comments:
------------------------------------------------------------------------
[2007-05-21 12:49:28] sander dot marechal at tribal dot nl
Description:
------------
When I add or update a file in the zip archive, I cannot read the new
file without closing and reopening the archive first.
If this turns out to be a limitation in zlib then I suggest that a
ZipArchive::flush() method of some sorts is added which can be called
between a write and a read to produce the expected result.
Reproduce code:
---------------
#!/usr/bin/php -q
<?php
// Please make sure a dummy test.zip exist before running this code
$zip = new ZipArchive();
$zip->open('test.zip');
$zip->addFromString('test.txt', 'some text');
echo "Before: " . $zip->getFromName('test.txt') . "\n";
$zip->close();
$zip->open('test.zip');
echo "After: " . $zip->getFromName('test.txt') . "\n";
?>
Expected result:
----------------
Both the 'before' and 'after' should output 'some text'.
Actual result:
--------------
'before' is empty. Only 'after' shows 'some text'.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=41456&edit=1