1--TEST--
2Phar: fopen a .phar for writing (new file)
3--EXTENSIONS--
4phar
5--INI--
6phar.readonly=1
7phar.require_hash=0
8--FILE--
9<?php
10$fname = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.php';
11$pname = 'phar://' . $fname;
12$file = "<?php __HALT_COMPILER(); ?>";
13
14$files = array();
15$files['a.php'] = '<?php echo "This is a\n"; ?>';
16$files['b.php'] = '<?php echo "This is b\n"; ?>';
17$files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
18include 'files/phar_test.inc';
19
20var_dump(fopen($pname . '/b/new.php', 'wb'));
21include $pname . '/b/c.php';
22include $pname . '/b/new.php';
23?>
24
25--CLEAN--
26<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
27--EXPECTF--
28Warning: fopen(phar://%sopen_for_write_newfile_b.phar.php/b/new.php): Failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %sopen_for_write_newfile_b.php on line %d
29bool(false)
30This is b/c
31
32Warning: include(phar://%sopen_for_write_newfile_b.phar.php/b/new.php): Failed to open stream: phar error: "b/new.php" is not a file in phar "%sopen_for_write_newfile_b.phar.php" in %sopen_for_write_newfile_b.php on line %d
33
34Warning: include(): Failed opening 'phar://%sopen_for_write_newfile_b.phar.php/b/new.php' for inclusion (include_path='%s') in %sopen_for_write_newfile_b.php on line %d
35
36