1--TEST--
2Phar::compressFiles(Phar::GZ) zip format
3--SKIPIF--
4<?php if (!extension_loaded("phar")) die("skip"); ?>
5<?php if (!extension_loaded("zlib")) die("skip zlib not present"); ?>
6--INI--
7phar.readonly=0
8--FILE--
9<?php
10$fname = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.zip.php';
11$pname = 'phar://' . $fname;
12
13$phar = new Phar($fname);
14$phar['a'] = 'a';
15$phar['b'] = 'b';
16$phar['c'] = 'c';
17
18var_dump(file_get_contents($pname . '/a'));
19var_dump($phar['a']->isCompressed());
20var_dump(file_get_contents($pname . '/b'));
21var_dump($phar['b']->isCompressed());
22var_dump(file_get_contents($pname . '/c'));
23var_dump($phar['c']->isCompressed());
24
25$phar->compressFiles(Phar::GZ);
26var_dump(file_get_contents($pname . '/a'));
27var_dump($phar['a']->isCompressed(Phar::BZ2));
28var_dump($phar['a']->isCompressed(Phar::GZ));
29var_dump(file_get_contents($pname . '/b'));
30var_dump($phar['b']->isCompressed(Phar::BZ2));
31var_dump($phar['b']->isCompressed(Phar::GZ));
32var_dump(file_get_contents($pname . '/c'));
33var_dump($phar['b']->isCompressed(Phar::BZ2));
34var_dump($phar['c']->isCompressed(Phar::GZ));
35
36?>
37--CLEAN--
38<?php
39unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.zip.php');
40?>
41--EXPECT--
42string(1) "a"
43bool(false)
44string(1) "b"
45bool(false)
46string(1) "c"
47bool(false)
48string(1) "a"
49bool(false)
50bool(true)
51string(1) "b"
52bool(false)
53bool(true)
54string(1) "c"
55bool(false)
56bool(true)
57