Annotation of embedaddon/php/ext/zlib/tests/gzseek_variation7.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test function gzseek() by calling it with SEEK_END when writing
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: echo "tell=";
17: var_dump(gztell($h));
18:
19: //seek to the end which is not sensible of course.
20: echo "move to the end of the file\n";
21: var_dump(gzseek($h, 0, SEEK_END));
22: echo "tell=";
23: var_dump(gztell($h));
24: gzwrite($h, $str2);
25: echo "tell=";
26: var_dump(gztell($h));
27: gzclose($h);
28: echo "\nreading the output file\n";
29: $h = gzopen($f, 'r');
30: gzpassthru($h);
31: gzclose($h);
32: echo "\n";
33: unlink($f);
34: ?>
35: ===DONE===
36: --EXPECTF--
37: tell=int(23)
38: move to the end of the file
39:
40: Warning: gzseek(): SEEK_END is not supported in %s on line %d
41: int(-1)
42: tell=int(23)
43: tell=int(47)
44:
45: reading the output file
46: This is the first line.This is the second line.
47: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>