File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / zlib / tests / zlib_filter_inflate2.phpt
Revision 1.1.1.2 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue May 29 12:34:38 2012 UTC (12 years, 1 month ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, HEAD
php 5.4.3+patches

--TEST--
zlib.inflate of gzip-encoded stream
--SKIPIF--
<?php if (!extension_loaded("zlib")) print "skip"; ?>
--FILE--
<?php /* $Id: zlib_filter_inflate2.phpt,v 1.1.1.2 2012/05/29 12:34:38 misho Exp $ */

$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

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