xref: /PHP-7.3/ext/zip/tests/doubleclose.phpt (revision bea30846)
1--TEST--
2close() called twice
3--SKIPIF--
4<?php
5if(!extension_loaded('zip')) die('skip');
6?>
7--FILE--
8<?php
9
10echo "Procedural\n";
11$zip = zip_open(dirname(__FILE__) . '/test.zip');
12if (!is_resource($zip)) {
13	die("Failure");
14	}
15var_dump(zip_close($zip));
16var_dump(zip_close($zip));
17
18echo "Object\n";
19$zip = new ZipArchive();
20if (!$zip->open(dirname(__FILE__) . '/test.zip')) {
21	die('Failure');
22}
23if ($zip->status == ZIPARCHIVE::ER_OK) {
24	var_dump($zip->close());
25	var_dump($zip->close());
26} else {
27	die("Failure");
28}
29
30?>
31Done
32--EXPECTF--
33Procedural
34NULL
35
36Warning: zip_close(): supplied resource is not a valid Zip Directory resource in %s
37bool(false)
38Object
39bool(true)
40
41Warning: ZipArchive::close(): Invalid or uninitialized Zip object in %s
42bool(false)
43Done
44