xref: /PHP-5.3/ext/zlib/tests/gzreadgzwrite.phpt (revision af49e58f)
1--TEST--
2gzopen(), gzread(), gzwrite()
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 = gzopen($filename, "wb");
12gzwrite($fp, $original);
13var_dump(strlen($original));
14var_dump(gztell($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}
25gzclose($fp);
26unlink($filename);
27?>
28--EXPECT--
29int(36864)
30int(36864)
31Strings are equal
32