xref: /PHP-8.2/ext/zlib/tests/gzclose_basic.phpt (revision 74859783)
1--TEST--
2Test function gzclose() by calling it with its expected arguments
3--EXTENSIONS--
4zlib
5--FILE--
6<?php
7// note that gzclose is an alias to fclose. parameter checking tests will be
8// the same as fclose
9
10$f = __DIR__."/004.txt.gz";
11$h = gzopen($f, 'r');
12gzread($h, 20);
13var_dump(gzclose($h));
14
15//should fail.
16try {
17    gzread($h, 20);
18} catch (TypeError $e) {
19    echo $e->getMessage(), "\n";
20}
21
22$h = gzopen($f, 'r');
23gzread($h, 20);
24var_dump(fclose($h));
25
26//should fail.
27try {
28    gzread($h, 20);
29} catch (TypeError $e) {
30    echo $e->getMessage(), "\n";
31}
32
33
34?>
35--EXPECT--
36bool(true)
37gzread(): supplied resource is not a valid stream resource
38bool(true)
39gzread(): supplied resource is not a valid stream resource
40