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