1--TEST--
2Phar::convertToTar() bz2 compressed
3--SKIPIF--
4<?php if (!extension_loaded("phar")) die("skip"); ?>
5<?php if (!extension_loaded("bz2")) die("skip"); ?>
6--INI--
7phar.require_hash=0
8phar.readonly=0
9--FILE--
10<?php
11
12$fname = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.php';
13$pname = 'phar://' . $fname;
14$fname2 = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.tar';
15$fname3 = __DIR__ . '/' . basename(__FILE__, '.php') . '.2.phar.tar';
16$stub = '<?php echo "first stub\n"; __HALT_COMPILER(); ?>';
17$file = $stub;
18
19$files = array();
20$files['a'] = 'a';
21$files['b'] = 'b';
22$files['c'] = 'c';
23
24include 'files/phar_test.inc';
25
26$phar = new Phar($fname);
27var_dump($phar->isFileFormat(Phar::TAR));
28var_dump($phar->isCompressed());
29var_dump($phar->getStub());
30
31$phar = $phar->convertToExecutable(Phar::TAR, Phar::BZ2);
32var_dump($phar->isFileFormat(Phar::TAR));
33var_dump($phar->isCompressed());
34var_dump($phar->getStub());
35
36copy($fname2 . '.bz2', $fname3);
37
38$phar = new Phar($fname3);
39var_dump($phar->isFileFormat(Phar::TAR));
40var_dump($phar->isCompressed() == Phar::BZ2);
41var_dump($phar->getStub());
42
43?>
44===DONE===
45--CLEAN--
46<?php
47unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.tar.bz2');
48unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.2.phar.tar');
49unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.tar');
50unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php');
51__HALT_COMPILER();
52?>
53--EXPECT--
54bool(false)
55bool(false)
56string(48) "<?php echo "first stub\n"; __HALT_COMPILER(); ?>"
57bool(true)
58int(8192)
59string(60) "<?php // tar-based phar archive stub file
60__HALT_COMPILER();"
61bool(true)
62bool(true)
63string(60) "<?php // tar-based phar archive stub file
64__HALT_COMPILER();"
65===DONE===
66