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