From: crabbydata at gmail dot com Operating system: MS Vista PHP version: 5.2.6 PHP Bug Type: Zip Related Bug description: Creation zipfiles with duplicate names in PHP results in crash Apache
Description: ------------ When creating a new zip-file with the "ZipArchive::CREATE"-function, and there already is a zipfile with the given filename Apache will crash without any warning (just a Vista error popup saying it has already stopped working). Reproduce code: --------------- <?php $zip = new ZipArchive(); $zipfile = "myveryownzipfile.zip"; if($zip->open($zipfile, ZipArchive::CREATE) !== true) exit("Can't create file ".$zipfile); // Add stuff inside the zip-file $zip->addFromString('tmp', 'bla'); // temporary file within zip $zip->close(); // Same code as above so two identical files are (tried to be) created if($zip->open($zipfile, ZipArchive::CREATE) !== true) exit("Can't create file ".$zipfile); // Add stuff inside the zip-file $zip->addFromString('tmp', 'bla'); // temporary file within zip $zip->close(); ?> Expected result: ---------------- When the second file is created, it should give out the exit-error: "Can't create file myveryownzipfile.zip". Or it should give a "fatal error!"-notice of PHP itself saying the filename already exists or simply that the (second) file could not be created (e.g. "duplicate filename"). Actual result: -------------- When activating this script (only with the creation of a single zipfile) through a form, and submitting it repeatingly (fast(!)), a (Vista) error pops up saying "Apache.exe doesn't work any longer" and Apache has been forced to shut down. Screenshots (I've a Dutch-language Vista): (1) http://img377.imageshack.us/img377/8170/06092008200500jp7.png Translation: "Apache HTTP Server has stopped working Searching for a solution..." (2) http://img156.imageshack.us/img156/4051/06092008195928sd1.png Translation: "Apache HTTP Server has stopped working An error occured which made the program function incorrectly. The program will now be closed and you'll get a notice when a solution is available." I installed/run PHP through the XAMPP-package (http://www.apachefriends.org/en/xampp.html). Zip-module information: Extension Version: $Id: php_zip.c,v 1.1.2.38 2007/08/06 22:02:32 bjori Exp $ Zip version: 2.0.0 Libzip version: 0.7.1 -- Edit bug report at http://bugs.php.net/?id=45222&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=45222&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=45222&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=45222&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=45222&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=45222&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=45222&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=45222&r=needscript Try newer version: http://bugs.php.net/fix.php?id=45222&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=45222&r=support Expected behavior: http://bugs.php.net/fix.php?id=45222&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=45222&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=45222&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=45222&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45222&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=45222&r=dst IIS Stability: http://bugs.php.net/fix.php?id=45222&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=45222&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=45222&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=45222&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=45222&r=mysqlcfg