php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #55383 Trying to open big archives (~2GB) produces error: ZIPARCHIVE::ER_NOZIP
Submitted: 2011-08-09 09:08 UTC Modified: 2013-10-15 11:54 UTC
Votes:17
Avg. Score:4.5 ± 0.7
Reproduced:17 of 17 (100.0%)
Same Version:6 (35.3%)
Same OS:4 (23.5%)
From: andreas at ultra-vires dot de Assigned:
Status: No Feedback Package: Zip Related
PHP Version: 5.3SVN-2011-08-08 (SVN) OS: WinXP (32Bit) & SuseLinux(64Bit)
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2011-08-09 09:08 UTC] 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.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-02-06 14:40 UTC] andreas at ultra-vires dot de
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??
 [2013-04-01 21:41 UTC] pajoye@php.net
-Status: Open +Status: Feedback
 [2013-10-15 11:54 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Thu Feb 20 08:01:24 2020 UTC