unixzip.phpt 593 B

1234567891011121314151617181920212223242526
  1. --TEST--
  2. Phar: test a zip archive created by unix "zip" command
  3. --EXTENSIONS--
  4. phar
  5. --FILE--
  6. <?php
  7. $a = new PharData(__DIR__ . '/files/zip.zip');
  8. foreach ($a as $b) {
  9. if ($b->isDir()) {
  10. echo "dir " . $b->getPathName() . "\n";
  11. } else {
  12. echo $b->getPathName(), "\n";
  13. echo file_get_contents($b->getPathName()), "\n";
  14. }
  15. }
  16. if (isset($a['notempty/hi.txt'])) {
  17. echo $a['notempty/hi.txt']->getPathName() . "\n";
  18. }
  19. ?>
  20. --EXPECTF--
  21. dir phar://%s/zip.zip%cempty
  22. phar://%s/zip.zip%chi.txt
  23. hi there
  24. dir phar://%s/zip.zip%cnotempty
  25. phar://%s/zip.zip/notempty%chi.txt