Bug #63802 [Asn->Fbk]: Hangs on garbage-data after end of archive

From: Date: Thu, 16 Apr 2015 12:33:58 +0000
Subject: Bug #63802 [Asn->Fbk]: Hangs on garbage-data after end of archive
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-192133@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=63802&edit=1 ID: 63802 Updated by: cmb@php.net Reported by: pecl at xu9 dot de Summary: Hangs on garbage-data after end of archive -Status: Assigned +Status: Feedback Type: Bug Package: Zip Related Operating System: Linux PHP Version: Irrelevant Assigned To: cmb Block user comment: N Private report: N New Comment: Unfortunately, the download link is broken now. Could you please make the problematic zip archive available for download again? Previous Comments: ------------------------------------------------------------------------ [2013-02-02 11:23:49] pecl at xu9 dot de In my first bug-report there is a link to an archive that triggers this error. http://xu9.de/test.zip ------------------------------------------------------------------------ [2013-02-01 23:07:12] pajoye@php.net Also drop me a mail with the archive or make it available somewhere please. ------------------------------------------------------------------------ [2013-02-01 23:06:03] pajoye@php.net Which version do you use? Peck install or bundled one? ------------------------------------------------------------------------ [2013-02-01 22:56:03] 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"; $zip->open($zipfile); print "extract"; $zip->extractTo($mydir); 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. ------------------------------------------------------------------------ [2012-12-19 08:49:34] pecl at xu9 dot de Description: ------------ 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 http://xu9.de/test.zip $zip = new ZipArchive(); $zip->open("test.zip"); 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", 'test.zip', $entry); $fh=fopen($xml,'r'); // ALSO HANGS! while (! feof($fh)) $data .= fgets($fh,8192); fclose($fh); $d = file_get_contents($xml); // ALSO HANGS! } ?> Expected result: ---------------- Getting content of file inside Actual result: -------------- Freezes ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=63802&edit=1

« previous php.bugs (#192133) next »