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 = dirname(__FILE__) . '/' . 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===DONE===
38--CLEAN--
39<?php
40unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.zip.php');
41?>
42--EXPECTF--
43string(1) "a"
44bool(false)
45string(1) "b"
46bool(false)
47string(1) "c"
48bool(false)
49string(1) "a"
50bool(false)
51bool(true)
52string(1) "b"
53bool(false)
54bool(true)
55string(1) "c"
56bool(false)
57bool(true)
58===DONE===
59