Bug #55383 [Opn]: Trying to open big archives (~2GB) produces error: ZIPARCHIVE::ER_NOZIP
Edit report at https://bugs.php.net/bug.php?id=55383&edit=1
ID: 55383
User updated by: andreas at ultra-vires dot de
Reported by: andreas at ultra-vires dot de
Summary: Trying to open big archives (~2GB) produces error:
ZIPARCHIVE::ER_NOZIP
Status: Open
Type: Bug
Package: Zip Related
Operating System: WinXP (32Bit) & SuseLinux(64Bit)
PHP Version: 5.3SVN-2011-08-08 (SVN)
Block user comment: N
Private report: N
New Comment:
Hello again,
some time passed by and I did some further tests on the ZipArchive class...with really strange
results... Here are my experiances:
Again, I have a very big archive:
Folders: 2346
Files: 109470
Size: 8158345387
Compressed: 5374915526
When I try to extract this archive with 7zip (7-Zip [64] 9.20), it tells me in the end:
"Everything is Ok"
Trying to open this archive with PHP's ZipArchive Class, always error
"ZIPARCHIVE:NO_ZIP" arrises (error code 19). (on the same Linux 64bit machine - Suse)
Well, I coded a shell execute in PHP and call the 7z binary which extracts this archive into a temp
folder -> success, all files are extracted as expected.
Next, I create a new ZipArchive like this:
<?php
$zip = new ZIPArchive();
if ($zip->open($new_ziparchive, ZIPARCHIVE::OVERWRITE) !== true)
die('Failed to create new ZIP-Archive: '.$new_ziparchive);
[...]
?>
No errors, since here.
Now, I recursively loop through the (sub)folders of the previously extracted archive (again:
extracted whith 7zip) and create the new ZIP-Archive with PHP ZipArchive Class... Successfully!!!
After $zip->close(); I've got a valid ZIP-Archive and there is no problem to access it with
7Zip. I can uncompress this without any problems.
BUT: When I try to open this ZIP with the PHP's ZipArchive Class again, the well known Error
"ER_NOZIP" (Error Code 19) comes up!
Strange: Creating very large archives is not a problem, but reading them after creation (whith the
same library!!!) is not possible with ZipArchive Class...
What the heck...?!
Any help, ideas, hints??
Previous Comments:
------------------------------------------------------------------------
[2011-08-09 09:08:19] andreas at ultra-vires dot de
Description:
------------
I try to read ZIP-Archives and always get Error "ZIPARCHIVE::ER_NOZIP" when size of the
archive is bigger than 1.xx GB (nearly 2 GB, and more) and ZIP contains more than 15.000 (bit more
or less) files.
Trying to open "very large" archives always fails with errocode
"ZIPARCHIVE::ER_NOZIP".
Sometimes I need to open "verly large" archies (up to 10 GB, containing 30.000 files or
even more). In some cases some sub-folders inside the archive contain more than 10.000 files... I
have no influence on the ZIP-Creation Process, so a tipp like "Try to create smaller
ZIPs!" doesn't help me. ;-)
But I need to look inside the archives, afterwards...
I've tested under WinXP SP3 (32Bit, PHP 5.3.1) and Suse Linux (64Bit, PHP 5.3.6).
PHP is running as Apache module. Both machines have the same phenomenon.
I did some tests with several different settings while compressing algos (using 7zip), but always
the same result. Smaller archives never produce that error.
Do exist limits (ammount of files / ZIP-Filesize) while handling ZIP-Archives in PHP? Trying to
list/extract theese "bad" Archives on the command line (e.g. with 7zip) always succeed.
This bug is different from Bug #44974: ZipArchive can't open large archives.
Again: I get "ZIPARCHIVE::ER_NOZIP", NOT "ZIPARCHIVE::ER_READ"!!
And I do not have problems on archives containing 1000, or 2000 files...
Thanks in advance.
Test script:
---------------
<?php
$file = "3GB_ArchiveWith30000Files.zip";
$zip = new ZipArchive();
$errCode = $zip->open($file, ZIPARCHIVE::CHECKCONS);
if ($errCode == ZIPARCHIVE::ER_NOZIP)
echo "Fail.";
// Outputs "Fail." :(
?>
Expected result:
----------------
Outputs "Fail." on large archives, since they contain ten thousands of files or/and have
filsize nearby 2GB.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=55383&edit=1
Thread (4 messages)