xref: /PHP-8.2/ext/zip/tests/bug7658.phpt (revision 74859783)
1--TEST--
2Bug #7658 (modify archive with general bit flag 3 set)
3--EXTENSIONS--
4zip
5--FILE--
6<?php
7$expect = array(
8    "mimetype",
9    "Configurations2/statusbar/",
10    "Configurations2/accelerator/current.xml",
11    "Configurations2/floater/",
12    "Configurations2/popupmenu/",
13    "Configurations2/progressbar/",
14    "Configurations2/menubar/",
15    "Configurations2/toolbar/",
16    "Configurations2/images/Bitmaps/",
17    "content.xml",
18    "styles.xml",
19    "meta.xml",
20    "Thumbnails/thumbnail.png",
21    "settings.xml",
22    "META-INF/manifest.xml",
23);
24$dirname = __DIR__ . '/';
25include $dirname . 'utils.inc';
26$file = $dirname . '__tmp_bug7658.odt';
27$zip = new ZipArchive();
28copy($dirname . 'bug7658.odt', $file);
29if(!$zip->open($file)) {
30    echo 'failed';
31}
32
33
34$zip->deleteName('content.xml');
35$zip->addFile($dirname . "bug7658.xml","content.xml");
36$zip->close();
37echo "\n";
38$zip->open($file);
39
40for($i=0; $i < $zip->numFiles; $i++) {
41    $sb = $zip->statIndex($i);
42    $found[] = $sb['name'];
43}
44$ar = array_diff($found, $expect);
45
46var_dump($ar);
47unset($zip);
48unlink($file);
49?>
50--EXPECT--
51array(0) {
52}
53