1--TEST-- 2Phar::setStub()/stopBuffering() zip-based 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.zip', 0, 'brandnewphar.phar'); 11$p['file1.txt'] = 'hi'; 12$p->stopBuffering(); 13var_dump($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()); 24var_dump($p->isFileFormat(Phar::ZIP)); 25?> 26===DONE=== 27--CLEAN-- 28<?php 29unlink(dirname(__FILE__) . '/brandnewphar.phar.zip'); 30?> 31--EXPECT-- 32string(60) "<?php // zip-based phar archive stub file 33__HALT_COMPILER();" 34string(200) "<?php 35function __autoload($class) 36{ 37 include 'phar://' . str_replace('_', '/', $class); 38} 39Phar::mapPhar('brandnewphar.phar'); 40include 'phar://brandnewphar.phar/startup.php'; 41__HALT_COMPILER(); ?> 42" 43bool(true) 44===DONE=== 45