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