#44974 [NEW]: ZipArchive can't open large archives

From: Date: Mon, 12 May 2008 18:19:41 +0000
Subject: #44974 [NEW]: ZipArchive can't open large archives
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-124918@lists.php.net to get a copy of this message
From:             florian dot ember at gmail dot com
Operating system: Debian
PHP version:      5.2.6
PHP Bug Type:     Zip Related
Bug description:  ZipArchive can't open large archives

Description:
------------
Opening archives with more than 1300 or so files fails with ER_READ. I
encountered this while using the close/reopen method to avoid using up all
available filehandles. On a Windows box the script below runs without
errors.

Reproduce code:
---------------
<?php
$za = new ZipArchive;
$za->open('./useless.zip', ZipArchive::CREATE);
for ($i = 1; $i <= 2000; ++$i) {
	$file = "$i.txt";
	touch($file);
	if (!$za->addFile("./$file", $file)) {
		exit("Couldn't add $file");
	}
	echo "Added $file<br />\n";
	if ($za->numFiles % 100 == 0) {
		$za->close();
		$res = $za->open('./useless.zip', ZipArchive::CREATE);
		if ($res !== true) {
			exit("Close/reopen: Error #$res @ $i");
		}
		echo "Close/reopen @ $i<br />\n";
	}
}
unlink('./useless.zip');
echo 'Done.';

Expected result:
----------------
Added 1.txt
Added 2.txt
[...]
Added 2000.txt
Done.

Actual result:
--------------
Added 1.txt
Added 2.txt
[...]
Added 1299.txt
Close/reopen: Error #5 @ 1300

-- 
Edit bug report at http://bugs.php.net/?id=44974&edit=1
-- 
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=44974&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=44974&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=44974&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=44974&r=fixedcvs
Fixed in release:             http://bugs.php.net/fix.php?id=44974&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=44974&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=44974&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=44974&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=44974&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=44974&r=notwrong
Not enough info:              http://bugs.php.net/fix.php?id=44974&r=notenoughinfo
Submitted twice:              http://bugs.php.net/fix.php?id=44974&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=44974&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=44974&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=44974&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=44974&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=44974&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=44974&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=44974&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=44974&r=mysqlcfg



Thread (8 messages)

« previous php.bugs (#124918) next »