1--TEST--
2Phar::startBuffering()/setStub()/stopBuffering()
3--SKIPIF--
4<?php
5if (!extension_loaded("phar")) die("skip");
6if (version_compare(PHP_VERSION, "6.0", "==")) die("skip pre-unicode version of PHP required");
7?>
8--INI--
9phar.require_hash=0
10phar.readonly=0
11--FILE--
12<?php
13$p = new Phar(dirname(__FILE__) . '/brandnewphar.phar', 0, 'brandnewphar.phar');
14//var_dump($p->getStub());
15var_dump($p->isBuffering());
16$p->startBuffering();
17var_dump($p->isBuffering());
18$p['a.php'] = '<?php var_dump("Hello");';
19$p->setStub('<?php var_dump("First"); Phar::mapPhar("brandnewphar.phar"); __HALT_COMPILER(); ?>');
20include 'phar://brandnewphar.phar/a.php';
21var_dump($p->getStub());
22$p['b.php'] = '<?php var_dump("World");';
23$p->setStub('<?php var_dump("Second"); Phar::mapPhar("brandnewphar.phar"); __HALT_COMPILER();');
24include 'phar://brandnewphar.phar/b.php';
25var_dump($p->getStub());
26$p->stopBuffering();
27echo "===COMMIT===\n";
28var_dump($p->isBuffering());
29include 'phar://brandnewphar.phar/a.php';
30include 'phar://brandnewphar.phar/b.php';
31var_dump($p->getStub());
32?>
33===DONE===
34--CLEAN--
35<?php
36unlink(dirname(__FILE__) . '/brandnewphar.phar');
37?>
38--EXPECT--
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