1--TEST--
2Phar::startBuffering()/setStub()/stopBuffering()
3--EXTENSIONS--
4phar
5--INI--
6phar.require_hash=0
7phar.readonly=0
8--FILE--
9<?php
10$p = new Phar(__DIR__ . '/phar_begin_setstub_commit.phar', 0, 'phar_begin_setstub_commit.phar');
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');
33?>
34--EXPECTF--
35bool(false)
36bool(true)
37string(5) "Hello"
38string(%d) "<?php var_dump("First"); Phar::mapPhar("phar_begin_setstub_commit.phar"); __HALT_COMPILER(); ?>
39"
40string(5) "World"
41string(%d) "<?php var_dump("Second"); Phar::mapPhar("phar_begin_setstub_commit.phar"); __HALT_COMPILER(); ?>
42"
43===COMMIT===
44bool(false)
45string(5) "Hello"
46string(5) "World"
47string(%d) "<?php var_dump("Second"); Phar::mapPhar("phar_begin_setstub_commit.phar"); __HALT_COMPILER(); ?>
48"
49