zip_entry_read buggy? runs endless on file with crc-error - freezes on corrupt file
| From: | Merlin Morgenstern | Date: | Wed, 08 Dec 2010 23:42:15 +0000 |
| Subject: | zip_entry_read buggy? runs endless on file with crc-error - freezes on corrupt file | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-309921@lists.php.net to get a copy of this message | ||
Hi there,
I am running a php file via cron where zip files will be extracted with the help of zip_entry_read. This worked great until I had a corrupted zip file to extract. This braught the server down as the php script never ended. The function max_execution_time does not help as it zip is a system function so the php script did run endless until the cron job trigered the next execution a minute later and so on!
It seams that the zip_entry_read function is buggy. I found 2 people with the similar problem, but no solution:
http://www.mombu.com/php/functions-forum/t-zip-freezes-how-to-handle-corrupt-crc-in-zip-file-3565173.html
http://coding.derkeiler.com/Archive/PHP/php.general/2007-08/msg00924.html
When I do a unzip on the console I do get following error from zip:
unzip 25_459.zip
Archive: 25_459.zip
error [25_459.zip]: missing 2203 bytes in zipfile
(attempting to process anyway)
retry - request = 0x4294965093
error [25_459.zip]: attempt to seek before beginning of zipfile
(please check that you have transferred or created the zipfile in the
appropriate BINARY mode and that you have compiled UnZip properly)
(attempting to re-compensate)
inflating: 459-03.jpg bad CRC b29a30c7 (should be 5a63b1bc)file #2: bad zipfile offset (local header sig): 94422 (attempting to re-compensate) file #2: bad zipfile offset (local header sig): 94422 file #3: bad zipfile offset (local header sig): 179720 file #4: bad zipfile offset (local header sig): 268127 file #5: bad zipfile offset (local header sig): 358277 file #6: bad zipfile offset (local header sig): 442834 file #7: bad zipfile offset (local header sig): 524802 file #8: bad zipfile offset (local header sig): 615587 How can i make zip_entry_read exit on error to solve the problem? Thank you for any idea, Merlin