Annotation of embedaddon/php/ext/phar/tests/open_for_write_existing_c.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Phar: fopen a .phar for writing (existing file)
3: --SKIPIF--
4: <?php
5: if (!extension_loaded("phar")) die("skip");
6: if (version_compare(PHP_VERSION, "5.3", "<")) die("skip requires 5.3 or later");
7: ?>
8: --INI--
9: phar.readonly=1
10: phar.require_hash=0
11: --FILE--
12: <?php
13: $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
14: $pname = 'phar://' . $fname;
15: $file = "<?php __HALT_COMPILER(); ?>";
16:
17: $files = array();
18: $files['a.php'] = '<?php echo "This is a\n"; ?>';
19: $files['b.php'] = '<?php echo "This is b\n"; ?>';
20: $files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
21: include 'files/phar_test.inc';
22:
23: $fp = fopen($pname . '/b/c.php', 'wb');
24: fwrite($fp, 'extra');
25: fclose($fp);
26: include $pname . '/b/c.php';
27: ?>
28: ===DONE===
29: --CLEAN--
30: <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
31: --EXPECTF--
32:
33: Warning: fopen(phar://%sopen_for_write_existing_c.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_c.php on line %d
34:
35: Warning: fwrite() expects parameter 1 to be resource, boolean given in %spen_for_write_existing_c.php on line %d
36:
37: Warning: fclose() expects parameter 1 to be resource, boolean given in %spen_for_write_existing_c.php on line %d
38: This is b/c
39: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>