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