1--TEST--
2Phar::convertToPhar() gzipped
3--EXTENSIONS--
4phar
5zlib
6--INI--
7phar.require_hash=0
8phar.readonly=0
9--FILE--
10<?php
11
12$fname = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar';
13$fname2 = __DIR__ . '/' . basename(__FILE__, '.php') . '2.phar';
14
15$phar = new Phar($fname);
16$phar['a.txt'] = 'some text';
17$phar->stopBuffering();
18var_dump($phar->isFileFormat(Phar::TAR));
19var_dump(strlen($phar->getStub()));
20
21$phar = $phar->convertToExecutable(Phar::TAR);
22var_dump($phar->isFileFormat(Phar::TAR));
23var_dump($phar->getStub());
24
25$phar['a'] = 'hi there';
26
27$phar = $phar->convertToExecutable(Phar::PHAR, Phar::GZ);
28var_dump($phar->isFileFormat(Phar::PHAR));
29var_dump($phar->isCompressed());
30var_dump(strlen($phar->getStub()));
31
32copy($fname . '.gz', $fname2);
33
34$phar = new Phar($fname2);
35var_dump($phar->isFileFormat(Phar::PHAR));
36var_dump($phar->isCompressed() == Phar::GZ);
37var_dump(strlen($phar->getStub()));
38
39?>
40--CLEAN--
41<?php
42unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar');
43unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.gz');
44unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.tar');
45unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '2.phar');
46__HALT_COMPILER();
47?>
48--EXPECT--
49bool(false)
50int(6641)
51bool(true)
52string(60) "<?php // tar-based phar archive stub file
53__HALT_COMPILER();"
54bool(true)
55int(4096)
56int(6641)
57bool(true)
58bool(true)
59int(6641)
60