1--TEST--
2gzopen(), gzread(), gzwrite() for non-compressed data
3--SKIPIF--
4<?php # vim600:syn=php:
5if (!extension_loaded("zlib")) print "skip"; ?>
6--FILE--
7<?php
8$original = str_repeat("hallo php",4096);
9$filename = tempnam("/tmp", "phpt");
10
11$fp = fopen($filename, "wb");
12fwrite($fp, $original);
13var_dump(strlen($original));
14var_dump(ftell($fp));
15fclose($fp);
16
17$fp = gzopen($filename, "rb");
18$data = gzread($fp, strlen($original));
19if ($data == $original) {
20	echo "Strings are equal\n";
21} else {
22	echo "Strings are not equal\n";
23	var_dump($data);
24}
25
26gzseek($fp, strlen($original) / 2);
27$data = gzread($fp, strlen($original));
28
29var_dump(strlen($data));
30if ($data == substr($original, strlen($original) / 2)) {
31	echo "Strings are equal\n";
32} else {
33	echo "Strings are not equal\n";
34	var_dump($data);
35}
36
37gzclose($fp);
38unlink($filename);
39?>
40--EXPECT--
41int(36864)
42int(36864)
43Strings are equal
44int(18432)
45Strings are equal
46