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
 [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

Pull Requests

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-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC