1--TEST--
2Phar::startBuffering()/setStub()/stopBuffering()
3--SKIPIF--
4<?php
5if (!extension_loaded("phar")) die("skip");
6?>
7--INI--
8phar.require_hash=0
9phar.readonly=0
10--FILE--
11<?php
12$p = new Phar(dirname(__FILE__) . '/brandnewphar.phar', 0, 'brandnewphar.phar');
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');
36?>
37--EXPECT--
38bool(false)
39bool(true)
40string(5) "Hello"
41string(84) "<?php var_dump("First"); Phar::mapPhar("brandnewphar.phar"); __HALT_COMPILER(); ?>
42"
43string(5) "World"
44string(85) "<?php var_dump("Second"); Phar::mapPhar("brandnewphar.phar"); __HALT_COMPILER(); ?>
45"
46===COMMIT===
47bool(false)
48string(5) "Hello"
49string(5) "World"
50string(85) "<?php var_dump("Second"); Phar::mapPhar("brandnewphar.phar"); __HALT_COMPILER(); ?>
51"
52===DONE===
53