php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45222 Creating zipfiles with duplicate names segfaults
Submitted: 2008-06-09 18:22 UTC Modified: 2008-07-19 01:00 UTC
From: crabbydata at gmail dot com Assigned:
Status: No Feedback Package: Zip Related
PHP Version: 5.2.6 OS: Windows Vista
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2008-06-09 18:22 UTC] crabbydata at gmail dot com
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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-07-19 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 27 07:01:29 2024 UTC