bug51353.phpt 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. --TEST--
  2. Bug #51353 ZIP64 problem, archive with 100000 items
  3. --EXTENSIONS--
  4. zip
  5. --SKIPIF--
  6. <?php
  7. die('skip the test might get very long, activate it manually');
  8. --FILE--
  9. <?php
  10. /* This test might get very long depending on the mashine it's running on. Therefore
  11. adding an explicit skip, remove it to run this test. */
  12. set_time_limit(0);
  13. $base_path = __DIR__;
  14. /* Either we ship a file with 100000 entries which would be >12M big,
  15. or create it dynamically. */
  16. $zip = new ZipArchive;
  17. $r = $zip->open("$base_path/51353.zip", ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE);
  18. if ($r) {
  19. for ($i = 0; $i < 100000; $i++) {
  20. $zip->addFromString("$i.txt", '1');
  21. }
  22. $zip->close();
  23. } else {
  24. die("failed");
  25. }
  26. $zip = new ZipArchive;
  27. $r = $zip->open("$base_path/51353.zip");
  28. if ($r) {
  29. $zip->extractTo("$base_path/51353_unpack");
  30. $zip->close();
  31. $a = glob("$base_path/51353_unpack/*.txt");
  32. echo count($a) . "\n";
  33. } else {
  34. die("failed");
  35. }
  36. echo "OK";
  37. --CLEAN--
  38. <?php
  39. $base_path = __DIR__;
  40. unlink("$base_path/51353.zip");
  41. $a = glob("$base_path/51353_unpack/*.txt");
  42. foreach($a as $f) {
  43. unlink($f);
  44. }
  45. rmdir("$base_path/51353_unpack");
  46. ?>
  47. --EXPECT--
  48. 100000
  49. OK