1--TEST--
2Phar::startBuffering()/setStub()/stopBuffering() tar-based
3--SKIPIF--
4<?php
5if (!extension_loaded("phar")) die("skip");
6?>
7--INI--
8phar.readonly=0
9--FILE--
10<?php
11$p = new Phar(dirname(__FILE__) . '/brandnewphar.phar.tar', 0, 'brandnewphar.phar');
12var_dump($p->isFileFormat(Phar::TAR));
13//var_dump($p->getStub());
14var_dump($p->isBuffering());
15$p->startBuffering();
16var_dump($p->isBuffering());
17$p['a.php'] = '<?php var_dump("Hello");';
18$p->setStub('<?php var_dump("First"); Phar::mapPhar("brandnewphar.phar"); __HALT_COMPILER(); ?>');
19include 'phar://brandnewphar.phar/a.php';
20var_dump($p->getStub());
21$p['b.php'] = '<?php var_dump("World");';
22$p->setStub('<?php var_dump("Second"); Phar::mapPhar("brandnewphar.phar"); __HALT_COMPILER();');
23include 'phar://brandnewphar.phar/b.php';
24var_dump($p->getStub());
25$p->stopBuffering();
26echo "===COMMIT===\n";
27var_dump($p->isBuffering());
28include 'phar://brandnewphar.phar/a.php';
29include 'phar://brandnewphar.phar/b.php';
30var_dump($p->getStub());
31?>
32===DONE===
33--CLEAN--
34<?php
35unlink(dirname(__FILE__) . '/brandnewphar.phar.tar');
36?>
37--EXPECT--
38bool(true)
39bool(false)
40bool(true)
41string(5) "Hello"
42string(84) "<?php var_dump("First"); Phar::mapPhar("brandnewphar.phar"); __HALT_COMPILER(); ?>
43"
44string(5) "World"
45string(85) "<?php var_dump("Second"); Phar::mapPhar("brandnewphar.phar"); __HALT_COMPILER(); ?>
46"
47===COMMIT===
48bool(false)
49string(5) "Hello"
50string(5) "World"
51string(85) "<?php var_dump("Second"); Phar::mapPhar("brandnewphar.phar"); __HALT_COMPILER(); ?>
52"
53===DONE===
54