1--TEST-- 2Phar::setStub()/getStub() 3--SKIPIF-- 4<?php if (!extension_loaded("phar")) die("skip"); ?> 5--INI-- 6phar.require_hash=0 7phar.readonly=0 8--FILE-- 9<?php 10$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php'; 11$pname = 'phar://' . $fname; 12$stub = '<?php echo "first stub\n"; __HALT_COMPILER(); ?>'; 13$file = $stub; 14 15$files = array(); 16$files['a'] = 'a'; 17 18include 'files/phar_test.inc'; 19 20$phar = new Phar($fname); 21var_dump($stub); 22var_dump($phar->getStub()); 23var_dump($phar->getStub() == $stub); 24 25$newstub = '<?php echo "second stub\n"; _x_HALT_COMPILER(); ?>'; 26try 27{ 28 $phar->setStub($newstub); 29} 30catch(exception $e) 31{ 32 echo 'Exception: ' . $e->getMessage() . "\n"; 33} 34var_dump($phar->getStub()); 35var_dump($phar->getStub() == $stub); 36$phar->stopBuffering(); 37var_dump($phar->getStub()); 38var_dump($phar->getStub() == $stub); 39 40?> 41===DONE=== 42--CLEAN-- 43<?php 44unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); 45__HALT_COMPILER(); 46?> 47--EXPECTF-- 48string(48) "<?php echo "first stub\n"; __HALT_COMPILER(); ?>" 49string(48) "<?php echo "first stub\n"; __HALT_COMPILER(); ?>" 50bool(true) 51Exception: illegal stub for phar "%sphar_stub_error.phar.php" 52string(48) "<?php echo "first stub\n"; __HALT_COMPILER(); ?>" 53bool(true) 54string(48) "<?php echo "first stub\n"; __HALT_COMPILER(); ?>" 55bool(true) 56===DONE=== 57