php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57111 cannot add a file to existing archive
Submitted: 2006-06-26 17:22 UTC Modified: 2006-06-27 11:38 UTC
From: irokez at gmail dot com Assigned: pajoye (profile)
Status: Closed Package: zip (PECL)
PHP Version: 5.1.2 OS: Windows XP SP1
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
35 - 23 = ?
Subscribe to this entry?

 
 [2006-06-26 17:22 UTC] irokez at gmail dot com
Description:
------------
I use create.php example from CVS and it works when creating new ZIP archive, but when I attempt to open existing one and add file, Zip::status sets equal to ZIP:ER_RENAME or 2 and archive is not modified (file is not added).

Reproduce code:
---------------
<?php
error_reporting(E_ALL);

$thisdir = dirname(__FILE__);
$filename = $thisdir . "/test112.zip";
$zip = new Zip();

if (!$zip->open($filename/*, ZIP::CREATE*/)) {
	exit("cannot open $filename\n");
} else {
	echo "file $filename OK\n";
}

$zip->addFromString("2.txt", "=)");
$zip->close();
echo "numfiles: " . $zip->numFiles . "\n";
echo "status:" . $zip->status . "\n";
?>

Expected result:
----------------
supposed to get:
numfiles: 1
status: 0

Actual result:
--------------
actually get:
numfiles: 1
status: 2

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-06-26 17:26 UTC] irokez at gmail dot com
link to archive I use - http://alex.erava.com/files/test112.zip
 [2006-06-26 18:45 UTC] pierre dot php at gmail dot com
Cannot reproduce on linux, I will try tomorrow on windows.
 [2006-06-27 11:38 UTC] pierre dot php at gmail dot com
Fixed in cvs. It should be available in the next windows snaps on pecl4win.php.net
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed May 05 23:01:24 2021 UTC