xref: /PHP-7.1/ext/zlib/tests/gzseek_basic.phpt (revision 113213f0)
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 = dirname(__FILE__)."/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===DONE===
34--EXPECT--
35move to the 50th byte
36int(0)
37tell=50
38string(10) " high abov"
39
40move forward to the 100th byte
41int(0)
42tell=100
43string(10) "Destiny wh"
44
45move backward to the 20th byte
46int(0)
47tell=20
48string(10) "hrough fee"
49===DONE===
50