Annotation of embedaddon/php/ext/zlib/tests/gzseek_variation5.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test function gzseek() by calling it with SEEK_CUR 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=".gztell($h)."\n";
                     17: 
                     18: //seek forwards 20 bytes.
                     19: gzseek($h, 20, SEEK_CUR);
                     20: echo "tell=".gztell($h)."\n";
                     21: gzwrite($h, $str2);
                     22: echo "tell=".gztell($h)."\n";
                     23: gzclose($h);
                     24: echo "\nreading the output file\n";
                     25: $h = gzopen($f, 'r');
                     26: echo gzread($h, strlen($str1))."\n";
                     27: echo var_dump(bin2hex(gzread($h, 20)));
                     28: echo gzread($h, strlen($str2))."\n";
                     29: gzclose($h);
                     30: unlink($f);
                     31: ?>
                     32: ===DONE===
                     33: --EXPECT--
                     34: tell=23
                     35: tell=43
                     36: tell=67
                     37: 
                     38: reading the output file
                     39: This is the first line.
                     40: string(40) "0000000000000000000000000000000000000000"
                     41: This is the second line.
                     42: ===DONE===

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>