xref: /PHP-5.5/ext/zip/tests/bug64342_1.phpt (revision 02e4d7a2)
1--TEST--
2Bug #64342 ZipArchive::addFile() has to check file existence (variation 2)
3--SKIPIF--
4<?php
5/* $Id$ */
6if(!extension_loaded('zip')) die('skip');
7?>
8--FILE--
9<?php
10
11$dirname = dirname(__FILE__) . '/';
12include $dirname . 'utils.inc';
13$file = $dirname . '__tmp_oo_addfile.zip';
14
15copy($dirname . 'test.zip', $file);
16
17$zip = new ZipArchive;
18if (!$zip->open($file)) {
19	exit('failed');
20}
21if (!$zip->addFile($dirname . 'cant_find_me.txt', 'test.php')) {
22	echo "failed\n";
23}
24if ($zip->status == ZIPARCHIVE::ER_OK) {
25	dump_entries_name($zip);
26	$zip->close();
27} else {
28	echo "failed\n";
29}
30@unlink($file);
31?>
32--EXPECTF--
33failed
340 bar
351 foobar/
362 foobar/baz
373 entry1.txt
38