2

I'm using ZipArchive to unzip files. It's working great, except for ONE file so far (it's 10.6MB, if that matters).

The problem is, ZipArchive::extractTo() returns FALSE, and that's correct since if fails.

BUT it doesn't completely fails: half of the file is being unzipped, and then it returns FALSE.

As this method doesn't throw any Exception, FALSE is not really great to understand what happened in the middle of that unzipping journey. If anyone already ran into that problem, i'd love some help :) Thanks!

  • check if this file has some special character in name, or if the destination folder already exists with a non write permission. – Paulo H. Dec 06 '11 at 13:17
  • thank you for your answer, but everything is alright on that side. I believe it wouldn't even extract almost half the archive if that was not the case. – user1062277 Dec 06 '11 at 13:24
  • Hi! I'm running a similar issue with a 100 folders ZIP, with around 3k XML files per folder. I can only extractTo 20 folders (and the containing files). No Exception or Return check. JFYI. – Raul Illana Sep 22 '12 at 05:14

1 Answers1

0

My problem is different, but I think you're running into a memory issue.

Try to force this:

ini_set('memory_limit', '128M');
set_time_limit(0);

Also, try to get memory usage before and after script, and deal with the total:

$mem_before = memory_get_usage();
/* your script code here */
$mem_after = memory_get_usage();
printf('Memory used: %1$s bytes', ($mem_after - $mem_before));

Maybe this points you in the right direction. ;)

Best!
R

Raul Illana
  • 328
  • 1
  • 3
  • 11