xref: /PHP-8.0/ext/zlib/tests/gzfile_basic.phpt (revision a555cc0b)
1--TEST--
2Test function gzfile() reading a gzip relative file
3--SKIPIF--
4<?php
5if (!extension_loaded('zlib')) die ('skip zlib extension not available in this build');
6?>
7--FILE--
8<?php
9$plaintxt = <<<EOT
10hello world
11is a very common test
12for all languages
13EOT;
14$dirname = 'gzfile_temp';
15$filename = $dirname.'/gzfile_basic.txt.gz';
16mkdir($dirname);
17$h = gzopen($filename, 'w');
18gzwrite($h, $plaintxt);
19gzclose($h);
20
21
22var_dump(gzfile( $filename ) );
23
24unlink($filename);
25rmdir($dirname);
26?>
27--EXPECT--
28array(3) {
29  [0]=>
30  string(12) "hello world
31"
32  [1]=>
33  string(22) "is a very common test
34"
35  [2]=>
36  string(17) "for all languages"
37}
38