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