1--TEST--
2Phar::setStub()/stopBuffering()
3--SKIPIF--
4<?php if (!extension_loaded("phar")) die("skip"); ?>
5--INI--
6phar.require_hash=0
7phar.readonly=0
8--FILE--
9<?php
10$p = new Phar(__DIR__ . '/phar_commitwrite.phar', 0, 'phar_commitwrite.phar');
11$p['file1.txt'] = 'hi';
12$p->stopBuffering();
13var_dump(strlen($p->getStub()));
14$p->setStub("<?php
15function __autoload(\$class)
16{
17    include 'phar://' . str_replace('_', '/', \$class);
18}
19Phar::mapPhar('phar_commitwrite.phar');
20include 'phar://phar_commitwrite.phar/startup.php';
21__HALT_COMPILER();
22?>");
23var_dump($p->getStub());
24?>
25===DONE===
26--CLEAN--
27<?php
28unlink(__DIR__ . '/phar_commitwrite.phar');
29__HALT_COMPILER();
30?>
31--EXPECTF--
32int(6641)
33string(%d) "<?php
34function __autoload($class)
35{
36    include 'phar://' . str_replace('_', '/', $class);
37}
38Phar::mapPhar('phar_commitwrite.phar');
39include 'phar://phar_commitwrite.phar/startup.php';
40__HALT_COMPILER(); ?>
41"
42===DONE===
43