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