bug72374.phpt 890 B

123456789101112131415161718192021222324252627282930313233
  1. --TEST--
  2. Bug #72374 (ZipArchive::addGlob remove_path option strips first char of filename)
  3. --EXTENSIONS--
  4. zip
  5. --FILE--
  6. <?php
  7. $dirname = dirname(__FILE__) . '/';
  8. include $dirname . 'utils.inc';
  9. $dirname = $dirname . 'bug72374';
  10. mkdir($dirname);
  11. $file1 = $dirname . '/some-foo.txt';
  12. touch($file1);
  13. $file2 = $dirname . '/some-bar.txt';
  14. touch($file2);
  15. $zip = new ZipArchive();
  16. $zip->open($dirname . '/test.zip', ZipArchive::CREATE | ZipArchive::OVERWRITE);
  17. $zip->addGlob($file1, 0, array('remove_path' => $dirname . '/some-'));
  18. $zip->addGlob($file1, 0, array('remove_path' => $dirname . '/'));
  19. $zip->addGlob($file2, 0, array('remove_path' => $dirname));
  20. verify_entries($zip, ['foo.txt', 'some-foo.txt', 'some-bar.txt']);
  21. $zip->close();
  22. ?>
  23. --CLEAN--
  24. <?php
  25. $dirname = dirname(__FILE__) . '/';
  26. include $dirname . 'utils.inc';
  27. $dirname = $dirname . 'bug72374';
  28. rmdir_rf($dirname);
  29. ?>
  30. --EXPECT--