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