Doc #51541 [NEW]: ZipArchive::addFile does not really add files

From: Date: Mon, 12 Apr 2010 09:37:25 +0000
Subject: Doc #51541 [NEW]: ZipArchive::addFile does not really add files
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-149504@lists.php.net to get a copy of this message
From: Operating system: Linux PHP version: 5.3SVN-2010-04-12 (SVN) Package: Zip Related Bug Type: Documentation Problem Bug description:ZipArchive::addFile does not really add files Description: ------------ Could you please let the documentation for ZipArchive::addFile() reflect, that the function doesn't really add the added files content to the zip archive any longer? As it seems, the files content is only read when storing the files now, as opposed to 5.2.8. So, if you delete a file directly after adding it to a zip archive, the archive won't be created any longer. I'm not really sure, if this is a bug, since the return value of addFile() isn't true any longer, or if this is just a documentation problem. Personaly, I don't care either way. I just spend about two hours, until I realized where the problem was. Having a reminder in the docs would have reduced this time down to about five minutes... There is a bug report (#40494) talking about such information in the manual, but the bug was marked bogus, and the manual was never updated. Essentially, that's why I opened this one as a documentation problem. Test script: --------------- <?php // works in PHP 5.2.8: $zipArchive='/path/2/my/archive'; $filesToAdd=array('/path/2/file1.ext', '/path/2/file2.ext', '/path/2/file3.ext'); $zip=new ZipArchive(); if(true===$zip->open($zipArchive,ZIPARCHIVE::CREATE)) foreach($filesToAdd as $file) if($zip->addFile($file,basename($file))) unlink($file); $zip->close(); /* Expected result: * Zip archive exists and contains the right data * * Actual result: * Version 5.2.8: * - Works flawlessly & as expected * Version 5.3.99-dev * - No zip archive created * - ZipArchive::GetStatusString reports a read error, * but only after closing the file */ ?> Expected result: ---------------- Zip archive exists and contains the right data. Actual result: -------------- Version 5.2.8: - Works flawlessly & as expected Version 5.3.99-dev - No zip archive created - ZipArchive::GetStatusString reports a read error, but only after closing the file -- Edit bug report at http://bugs.php.net/bug.php?id=51541&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=51541&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=51541&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=51541&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=51541&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=51541&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=51541&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=51541&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=51541&r=needscript Try newer version: http://bugs.php.net/fix.php?id=51541&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=51541&r=support Expected behavior: http://bugs.php.net/fix.php?id=51541&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=51541&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=51541&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=51541&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=51541&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=51541&r=dst IIS Stability: http://bugs.php.net/fix.php?id=51541&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=51541&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=51541&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=51541&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=51541&r=mysqlcfg

« previous php.bugs (#149504) next »