bug64342_1-mb.phpt 843 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. --TEST--
  2. Bug #64342 ZipArchive::addFile() has to check file existence (variation 2)
  3. --EXTENSIONS--
  4. zip
  5. --FILE--
  6. <?php
  7. $dirname = __DIR__ . '/';
  8. include $dirname . 'utils.inc';
  9. $file = $dirname . '__私はガラスを食べられますtmp_oo_addfile.zip';
  10. copy($dirname . 'test.zip', $file);
  11. $zip = new ZipArchive;
  12. if (!$zip->open($file)) {
  13. exit('failed');
  14. }
  15. if (!$zip->addFile($dirname . 'cant_find_me.txt', 'test.php')) {
  16. echo "failed\n";
  17. }
  18. if ($zip->status == ZIPARCHIVE::ER_OK) {
  19. if (!verify_entries($zip, [
  20. "bar",
  21. "foobar/",
  22. "foobar/baz",
  23. "entry1.txt"
  24. ])) {
  25. echo "failed\n";
  26. } else {
  27. echo "OK";
  28. }
  29. $zip->close();
  30. } else {
  31. echo "failed\n";
  32. }
  33. @unlink($file);
  34. ?>
  35. --EXPECTF--
  36. Warning: ZipArchive::addFile(): No such file or directory in %s on line %d
  37. failed
  38. OK