Reputation: 834
I have to traverse all files in a zip file that contains 65000 files approx. But it only able to read 315 files.
Unable to find the reason, no error in error log. I have used following code:
<?php
$zip = zip_open($newfile);
if ($zip) {
$counter = 0;
while ($zip_entry = zip_read($zip)) {
$counter++;
$filename = zip_entry_name($zip_entry);
echo $counter . "-" . $filename . "<br/>";
}
zip_close($zip);
}
Upvotes: 2
Views: 123
Reputation: 11406
The number of files in a (regular) zip file is stored in an unsigned 16 bit integer
. This means the maximum value is 65535.
Could it be that you have more than 65535 enties in that zip file, and that this integer overflows and only shows num_files - 65536
, 315 in your case?
Upvotes: 1