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(dirname(__FILE__) . '/brandnewphar.phar', 0, 'brandnewphar.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('brandnewphar.phar');
20include 'phar://brandnewphar.phar/startup.php';
21__HALT_COMPILER();
22?>");
23var_dump($p->getStub());
24?>
25===DONE===
26--CLEAN--
27<?php
28unlink(dirname(__FILE__) . '/brandnewphar.phar');
29__HALT_COMPILER();
30?>
31--EXPECT--
32int(6673)
33string(200) "<?php
34function __autoload($class)
35{
36    include 'phar://' . str_replace('_', '/', $class);
37}
38Phar::mapPhar('brandnewphar.phar');
39include 'phar://brandnewphar.phar/startup.php';
40__HALT_COMPILER(); ?>
41"
42===DONE===