oo_getcomment.phpt 763 B

123456789101112131415161718192021222324252627282930313233343536
  1. --TEST--
  2. getComment
  3. --SKIPIF--
  4. <?php
  5. /* $Id$ */
  6. if(!extension_loaded('zip')) die('skip');
  7. ?>
  8. --FILE--
  9. <?php
  10. $dirname = dirname(__FILE__) . '/';
  11. $file = $dirname . 'test_with_comment.zip';
  12. include $dirname . 'utils.inc';
  13. $zip = new ZipArchive;
  14. if (!$zip->open($file)) {
  15. exit('failed');
  16. }
  17. echo $zip->getArchiveComment() . "\n";
  18. $idx = $zip->locateName('foo');
  19. echo $zip->getCommentName('foo') . "\n";
  20. echo $zip->getCommentIndex($idx);
  21. echo $zip->getCommentName('') . "\n";
  22. echo $zip->getCommentName() . "\n";
  23. $zip->close();
  24. ?>
  25. --EXPECTF--
  26. Zip archive comment
  27. foo comment
  28. foo comment
  29. Notice: ZipArchive::getCommentName(): Empty string as entry name in %s on line %d
  30. Warning: ZipArchive::getCommentName() expects at least 1 parameter, 0 given in %s on line %d