1--TEST-- 2Phar: fopen a .phar for writing (new file) tar-based 3--SKIPIF-- 4<?php if (!extension_loaded("phar")) die("skip"); ?> 5--INI-- 6phar.readonly=0 7phar.require_hash=0 8--FILE-- 9<?php 10 11$fname = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.tar'; 12$alias = 'phar://' . $fname; 13 14$phar = new Phar($fname); 15$phar->setStub("<?php __HALT_COMPILER(); ?>"); 16 17$files = array(); 18 19$files['a.php'] = '<?php echo "This is a\n"; ?>'; 20$files['b.php'] = '<?php echo "This is b\n"; ?>'; 21$files['b/c.php'] = '<?php echo "This is b/c\n"; ?>'; 22 23foreach ($files as $n => $file) { 24 $phar[$n] = $file; 25} 26 27$phar->stopBuffering(); 28 29$fp = fopen($alias . '/b/new.php', 'wb'); 30fwrite($fp, 'extra'); 31fclose($fp); 32 33include $alias . '/b/c.php'; 34include $alias . '/b/new.php'; 35 36?> 37 38--CLEAN-- 39<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.tar'); ?> 40--EXPECT-- 41This is b/c 42extra 43