xref: /PHP-7.4/ext/zip/tests/bug8700.phpt (revision 26dfce7f)
1--TEST--
2Bug #8700 (getFromIndex(0) fails)
3--SKIPIF--
4<?php
5if(!extension_loaded('zip')) die('skip');
6?>
7--FILE--
8<?php
9$thisdir = __DIR__;
10$filename = $thisdir . "/bug8009.zip";
11
12$zip = new ZipArchive();
13
14if ($zip->open($filename) === FALSE) {
15       exit("cannot open $filename\n");
16}
17$contents_from_idx = $zip->getFromIndex(0);
18$contents_from_name = $zip->getFromName('1.txt');
19if ($contents_from_idx != $contents_from_name) {
20	echo "failed:";
21	var_dump($content_from_idx, $content_from_name);
22}
23
24$zip->close();
25echo "status: " . $zip->status . "\n";
26echo "\n";
27--EXPECT--
28status: 0
29