1--TEST-- 2Phar: fopen a .phar for writing (existing file) 3--SKIPIF-- 4<?php 5if (!extension_loaded("phar")) die("skip"); 6?> 7--INI-- 8phar.readonly=1 9phar.require_hash=0 10--FILE-- 11<?php 12$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php'; 13$pname = 'phar://' . $fname; 14$file = "<?php __HALT_COMPILER(); ?>"; 15 16$files = array(); 17$files['a.php'] = '<?php echo "This is a\n"; ?>'; 18$files['b.php'] = '<?php echo "This is b\n"; ?>'; 19$files['b/c.php'] = '<?php echo "This is b/c\n"; ?>'; 20include 'files/phar_test.inc'; 21 22function err_handler($errno, $errstr, $errfile, $errline) { 23 echo "Recoverable fatal error: $errstr in $errfile on line $errline\n"; 24} 25 26set_error_handler("err_handler", E_RECOVERABLE_ERROR); 27 28$fp = fopen($pname . '/b/c.php', 'wb'); 29fwrite($fp, 'extra'); 30fclose($fp); 31include $pname . '/b/c.php'; 32?> 33===DONE=== 34--CLEAN-- 35<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?> 36--EXPECTF-- 37Warning: fopen(phar://%sopen_for_write_existing_b.phar.php/b/c.php): failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %sopen_for_write_existing_b.php on line %d 38 39Warning: fwrite() expects parameter 1 to be resource, bool given in %sopen_for_write_existing_b.php on line %d 40 41Warning: fclose() expects parameter 1 to be resource, bool given in %sopen_for_write_existing_b.php on line %d 42This is b/c 43===DONE=== 44