1--TEST--
2Phar::setStub()/stopBuffering() tar-based
3--SKIPIF--
4<?php if (!extension_loaded("phar")) die("skip"); ?>
5--INI--
6phar.require_hash=0
7phar.readonly=0
8--ENV--
9TEMP=.
10TMP=.
11--FILE--
12<?php
13$p = new Phar(dirname(__FILE__) . '/brandnewphar.phar.tar', 0, 'brandnewphar.phar');
14$p['file1.txt'] = 'hi';
15$p->stopBuffering();
16var_dump($p->getStub());
17$p->setStub("<?php
18function __autoload(\$class)
19{
20    include 'phar://' . str_replace('_', '/', \$class);
21}
22Phar::mapPhar('brandnewphar.phar');
23include 'phar://brandnewphar.phar/startup.php';
24__HALT_COMPILER();
25?>");
26var_dump($p->getStub());
27var_dump($p->isFileFormat(Phar::TAR));
28?>
29===DONE===
30--CLEAN--
31<?php
32unlink(dirname(__FILE__) . '/brandnewphar.phar.tar');
33?>
34--EXPECT--
35string(60) "<?php // tar-based phar archive stub file
36__HALT_COMPILER();"
37string(200) "<?php
38function __autoload($class)
39{
40    include 'phar://' . str_replace('_', '/', $class);
41}
42Phar::mapPhar('brandnewphar.phar');
43include 'phar://brandnewphar.phar/startup.php';
44__HALT_COMPILER(); ?>
45"
46bool(true)
47===DONE===
48