|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63802 Hangs on garbage-data after end of archive
Submitted: 2012-12-19 08:49 UTC Modified: 2015-04-26 04:22 UTC
Avg. Score:4.7 ± 0.7
Reproduced:5 of 5 (100.0%)
Same Version:2 (40.0%)
Same OS:2 (40.0%)
From: pecl at xu9 dot de Assigned: cmb (profile)
Status: No Feedback Package: Zip Related
PHP Version: Irrelevant OS: Linux
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 — but make sure to vote on the bug!
Your email address:
Solve the problem:
2 + 41 = ?
Subscribe to this entry?

 [2012-12-19 08:49 UTC] pecl at xu9 dot de
I stumbled upon this bug because my import-scripts kept hanging on the same file over and over.

The files itself are created by some kind of Windows CE Appliance. The wrapper from Midnight Commander (written in Perl) seems to have similar problems but it just wont open the file instead of freezing.

Inside the File it seems that the "PK"-Signature is repeating shortly before the end of the archive.

"unzip" commandline utility works and does not find any errors.

Test script:
// sample-zip at
$zip = new ZipArchive();

print $zip->numFiles . " Files inside\n";flush();
for ($i = 0; $i < $zip->numFiles; $i++) {
    $entry = $zip->getNameIndex($i);
    $zip->extractTo('/tmp');   // HANGS!

    $xml = sprintf("zip://%s#%s", '', $entry);

    $fh=fopen($xml,'r'); // ALSO HANGS!
    while (! feof($fh)) $data .= fgets($fh,8192);

    $d = file_get_contents($xml); // ALSO HANGS!


Expected result:
Getting content of file inside

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2013-02-01 22:56 UTC] edwardvb at formulaworld dot com
I am experiencing the very same problem... about 1 out of 10 zip-files (usually filled with 1 or max 10 file) hang on the $zip->extractTo() command.

the zip files come from various sources. I don't know how they are created.

my code is quite straightforward:
print "start";
$zip = new ZipArchive();
print "open zipfile";
print "extract";
print "finished extracting";    // this line is never printed

during my last test I have a 318kB Zipfile, containing ONE xml file of 5060kB. The xml file is created in $mydir, but has a size of 5056kB and misses the last few characters in the xml-file.... meanwhile the php code is not executed any further, but hangs on $zip->extractTo($mydir)... until the max execution time is reached.
 [2013-02-01 23:06 UTC]
Which version do you use? Peck install or bundled one?
 [2013-02-01 23:07 UTC]
-Status: Open +Status: Feedback
 [2013-02-01 23:07 UTC]
Also drop me a mail with the archive or make it available somewhere please.
 [2013-02-02 11:23 UTC] pecl at xu9 dot de
In my first bug-report there is a link to an archive that triggers this error.
 [2013-02-02 11:23 UTC] pecl at xu9 dot de
-Status: Feedback +Status: Open
 [2015-04-16 01:25 UTC]
-Package: zip +Package: Zip Related -Assigned To: +Assigned To: cmb
 [2015-04-16 12:33 UTC]
-Status: Assigned +Status: Feedback
 [2015-04-16 12:33 UTC]
Unfortunately, the download link is broken now. Could you please
make the problematic zip archive available for download again?
 [2015-04-26 04:22 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-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 05 15:01:31 2024 UTC