summaryrefslogtreecommitdiff
path: root/ext/zlib/tests/zlib_filter_inflate2.phpt
blob: a2099b6f7a2f49364d9df61627cf1e4427f73127 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
--TEST--
zlib.inflate of gzip-encoded stream
--SKIPIF--
<?php if (!extension_loaded("zlib")) print "skip"; ?>
--FILE--
<?php /* $Id$ */

$a = gzopen(dirname(__FILE__) . '/test.txt.gz', 'w');
fwrite($a, b"This is quite the thing ain't it\n");
fclose($a);

$fp = fopen(dirname(__FILE__) . '/test.txt.gz', 'r');
stream_filter_append($fp, 'zlib.inflate', STREAM_FILTER_READ);
echo fread($fp, 2000);
fclose($fp);
echo "1\n";
$fp = fopen(dirname(__FILE__) . '/test.txt.gz', 'r');
// zlib format
$fp = fopen(dirname(__FILE__) . '/test.txt.gz', 'r');
stream_filter_append($fp, 'zlib.inflate', STREAM_FILTER_READ, array('window' => 15+16));
echo "2\n";
echo fread($fp, 2000);
fclose($fp);
// auto-detect
$fp = fopen(dirname(__FILE__) . '/test.txt.gz', 'r');
stream_filter_append($fp, 'zlib.inflate', STREAM_FILTER_READ, array('window' => 15+32));
echo "3\n";
echo fread($fp, 2000);
fclose($fp);

?>
--CLEAN--
<?php
@unlink(dirname(__FILE__) . '/test.txt.gz');
?>
--EXPECT--
1
2
This is quite the thing ain't it
3
This is quite the thing ain't it