1--TEST--
2zlib.inflate of gzip-encoded stream
3--SKIPIF--
4<?php if (!extension_loaded("zlib")) print "skip"; ?>
5--FILE--
6<?php /* $Id$ */
7
8$a = gzopen(dirname(__FILE__) . '/test.txt.gz', 'w');
9fwrite($a, b"This is quite the thing ain't it\n");
10fclose($a);
11
12$fp = fopen(dirname(__FILE__) . '/test.txt.gz', 'r');
13stream_filter_append($fp, 'zlib.inflate', STREAM_FILTER_READ);
14echo fread($fp, 2000);
15fclose($fp);
16echo "1\n";
17$fp = fopen(dirname(__FILE__) . '/test.txt.gz', 'r');
18// zlib format
19$fp = fopen(dirname(__FILE__) . '/test.txt.gz', 'r');
20stream_filter_append($fp, 'zlib.inflate', STREAM_FILTER_READ, array('window' => 15+16));
21echo "2\n";
22echo fread($fp, 2000);
23fclose($fp);
24// auto-detect
25$fp = fopen(dirname(__FILE__) . '/test.txt.gz', 'r');
26stream_filter_append($fp, 'zlib.inflate', STREAM_FILTER_READ, array('window' => 15+32));
27echo "3\n";
28echo fread($fp, 2000);
29fclose($fp);
30
31?>
32--CLEAN--
33<?php
34@unlink(dirname(__FILE__) . '/test.txt.gz');
35?>
36--EXPECT--
371
382
39This is quite the thing ain't it
403
41This is quite the thing ain't it
42