xref: /PHP-8.1/ext/zlib/tests/gzeof_basic.phpt (revision 74859783)
1--TEST--
2Test function feof() by calling it with its expected arguments
3--EXTENSIONS--
4zlib
5--FILE--
6<?php
7// note that gzeof is an alias to gzeof. parameter checking tests will be
8// the same as gzeof
9
10$f = __DIR__."/004.txt.gz";
11
12echo "-- test 1 --\n";
13$h = gzopen($f, 'r');
14var_dump(gzeof($h));
15gzpassthru($h);
16var_dump(gzeof($h));
17gzclose($h);
18
19echo "\n-- test 2 --\n";
20$h = gzopen($f, 'r');
21echo "reading 50 characters. eof should be false\n";
22gzread($h, 50)."\n";
23var_dump(gzeof($h));
24echo "reading 250 characters. eof should be true\n";
25gzread($h, 250)."\n";
26var_dump(gzeof($h));
27echo "reading 20 characters. eof should be true still\n";
28gzread($h, 20)."\n";
29var_dump(gzeof($h));
30gzclose($h);
31
32
33
34?>
35--EXPECT--
36-- test 1 --
37bool(false)
38When you're taught through feelings
39Destiny flying high above
40all I know is that you can realize it
41Destiny who cares
42as it turns around
43and I know that it descends down on me
44bool(true)
45
46-- test 2 --
47reading 50 characters. eof should be false
48bool(false)
49reading 250 characters. eof should be true
50bool(true)
51reading 20 characters. eof should be true still
52bool(true)
53