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