Annotation of embedaddon/php/ext/zlib/tests/gzseek_variation1.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test function gzseek() by seeking forward in write mode
3: --SKIPIF--
4: <?php
5: if (!extension_loaded("zlib")) {
6: print "skip - ZLIB extension not loaded";
7: }
8: ?>
9: --FILE--
10: <?php
11: $f = "temp3.txt.gz";
12: $h = gzopen($f, 'w');
13: $str1 = "This is the first line.";
14: $str2 = "This is the second line.";
15: gzwrite($h, $str1);
16:
17: //seek forwards 20 bytes.
18: gzseek($h, strlen($str1) + 20);
19: gzwrite($h, $str2);
20: gzclose($h);
21: $h = gzopen($f, 'r');
22: echo gzread($h, strlen($str1))."\n";
23: echo var_dump(bin2hex(gzread($h, 20)));
24: echo gzread($h, strlen($str2))."\n";
25: gzclose($h);
26: unlink($f);
27: ?>
28: ===DONE===
29: --EXPECT--
30: This is the first line.
31: string(40) "0000000000000000000000000000000000000000"
32: This is the second line.
33: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>