xref: /PHP-8.0/ext/zlib/tests/gzseek_basic.phpt (revision c5401854)
1--TEST--
2Test function gzseek() by calling it with its expected arguments when reading
3--SKIPIF--
4<?php
5if (!extension_loaded("zlib")) {
6    print "skip - ZLIB extension not loaded";
7}
8?>
9--FILE--
10<?php
11$f = __DIR__."/004.txt.gz";
12$h = gzopen($f, 'r');
13
14echo "move to the 50th byte\n";
15var_dump(gzseek( $h, 50 ) );
16echo "tell=".gztell($h)."\n";
17//read the next 10
18var_dump(gzread($h, 10));
19
20echo "\nmove forward to the 100th byte\n";
21var_dump(gzseek( $h, 100 ) );
22echo "tell=".gztell($h)."\n";
23//read the next 10
24var_dump(gzread($h, 10));
25
26echo "\nmove backward to the 20th byte\n";
27var_dump(gzseek( $h, 20 ) );
28echo "tell=".gztell($h)."\n";
29//read the next 10
30var_dump(gzread($h, 10));
31gzclose($h);
32?>
33--EXPECT--
34move to the 50th byte
35int(0)
36tell=50
37string(10) " high abov"
38
39move forward to the 100th byte
40int(0)
41tell=100
42string(10) "Destiny wh"
43
44move backward to the 20th byte
45int(0)
46tell=20
47string(10) "hrough fee"
48