xref: /PHP-7.3/ext/phar/tests/phar_gzip.phpt (revision 113213f0)
1--TEST--
2Phar: gzipped phar
3--SKIPIF--
4<?php
5if (!extension_loaded("phar")) die("skip");
6if (!extension_loaded("zlib")) die("skip zlib not available");
7?>
8--INI--
9phar.readonly=0
10phar.require_hash=0
11--FILE--
12<?php
13$fname = dirname(__FILE__) . '/phar_gzip.phar';
14$pname = 'phar://' . $fname;
15$fname2 = dirname(__FILE__) . '/phar_gzip.2.phar';
16$pname2 = 'phar://' . $fname2;
17
18$file = '<?php
19Phar::mapPhar();
20var_dump("it worked");
21include "phar://" . __FILE__ . "/tar_004.php";
22__HALT_COMPILER();';
23
24$files = array();
25$files['tar_004.php']   = '<?php var_dump(__FILE__);';
26$files['internal/file/here']   = "hi there!\n";
27$files['internal/dir/'] = '';
28$files['dir/'] = '';
29$gzip = true;
30
31include 'files/phar_test.inc';
32
33include $fname;
34
35$a = new Phar($fname);
36$a['test'] = 'hi';
37copy($fname, $fname2);
38$a->setAlias('another');
39$b = new Phar($fname2);
40var_dump($b->isFileFormat(Phar::PHAR));
41var_dump($b->isCompressed() == Phar::GZ);
42$a = stat($pname . '/test');
43$b = stat($pname2 . '/test');
44if ($a['mtime'] != $b['mtime']) {
45	echo "timestamp changed, was $a[mtime], now $b[mtime]!\n";
46}
47?>
48===DONE===
49--CLEAN--
50<?php
51@unlink(dirname(__FILE__) . '/phar_gzip.phar');
52@unlink(dirname(__FILE__) . '/phar_gzip.2.phar');
53?>
54--EXPECTF--
55string(9) "it worked"
56string(%d) "phar://%sphar_gzip.phar/tar_004.php"
57bool(true)
58bool(true)
59===DONE===
60