xref: /PHP-7.0/ext/zlib/tests/gzseek_basic2.phpt (revision 5fd7c2b0)
1--TEST--
2Test function gzseek() by calling it with its expected arguments when writing
3--SKIPIF--
4<?php
5if (!extension_loaded("zlib")) {
6	print "skip - ZLIB extension not loaded";
7}
8?>
9--FILE--
10<?php
11$f = "gzseek_basic2.gz";
12$h = gzopen($f, 'w');
13$str1 = "This is the first line.";
14$str2 = "This is the second line.";
15gzwrite($h, $str1);
16echo "tell=".gztell($h)."\n";
17
18//seek forwards 20 bytes.
19gzseek($h, strlen($str1) + 20);
20echo "tell=".gztell($h)."\n";
21gzwrite($h, $str2);
22echo "tell=".gztell($h)."\n";
23gzclose($h);
24echo "\nreading the output file\n";
25$h = gzopen($f, 'r');
26echo gzread($h, strlen($str1))."\n";
27var_dump(bin2hex(gzread($h, 20)));
28echo gzread($h, strlen($str2))."\n";
29gzclose($h);
30unlink($f);
31?>
32===DONE===
33--EXPECT--
34tell=23
35tell=43
36tell=67
37
38reading the output file
39This is the first line.
40string(40) "0000000000000000000000000000000000000000"
41This is the second line.
42===DONE===
43