bug14962.phpt 608 B

12345678910111213141516171819202122232425262728293031
  1. --TEST--
  2. Bug #14962 (::extractTo second argument is not really optional)
  3. --EXTENSIONS--
  4. zip
  5. --FILE--
  6. <?php
  7. $dir = __DIR__;
  8. $file = '__tmp14962.txt';
  9. $fullpath = $dir . '/' . $file;
  10. $za = new ZipArchive;
  11. $za->open($dir . '/__14962.zip', ZIPARCHIVE::CREATE);
  12. $za->addFromString($file, '1234');
  13. $za->close();
  14. if (!is_file($dir . "/__14962.zip")) {
  15. die('failed to create the archive');
  16. }
  17. $za = new ZipArchive;
  18. $za->open($dir . '/__14962.zip');
  19. $za->extractTo($dir, NULL);
  20. $za->close();
  21. if (is_file($fullpath)) {
  22. unlink($fullpath);
  23. echo "Ok";
  24. }
  25. unlink($dir . '/' . '__14962.zip');
  26. ?>
  27. --EXPECT--
  28. Ok