#41456 [NEW]: Cannot decompress newly added files

From: Date: Mon, 21 May 2007 12:49:28 +0000
Subject: #41456 [NEW]: Cannot decompress newly added files
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-112903@lists.php.net to get a copy of this message
From: sander dot marechal at tribal dot nl Operating system: Linux PHP version: 5.2.2 PHP Bug Type: Zip Related Bug description: Cannot decompress newly added files 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 bug report at http://bugs.php.net/?id=41456&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=41456&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=41456&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=41456&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=41456&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=41456&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=41456&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=41456&r=needscript Try newer version: http://bugs.php.net/fix.php?id=41456&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=41456&r=support Expected behavior: http://bugs.php.net/fix.php?id=41456&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=41456&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=41456&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=41456&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41456&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=41456&r=dst IIS Stability: http://bugs.php.net/fix.php?id=41456&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=41456&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=41456&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=41456&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=41456&r=mysqlcfg

« previous php.bugs (#112903) next »