Annotation of embedaddon/php/ext/phar/tests/open_for_write_newfile_b_5_2.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Phar: fopen a .phar for writing (new file)
3: --SKIPIF--
4: <?php if (!extension_loaded("phar")) die("skip"); ?>
5: <?php if (version_compare(PHP_VERSION, "5.3", ">")) die("skip requires 5.2 or earlier"); ?>
6: --INI--
7: phar.readonly=1
8: phar.require_hash=0
9: --FILE--
10: <?php
11: $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
12: $pname = 'phar://' . $fname;
13: $file = "<?php __HALT_COMPILER(); ?>";
14:
15: $files = array();
16: $files['a.php'] = '<?php echo "This is a\n"; ?>';
17: $files['b.php'] = '<?php echo "This is b\n"; ?>';
18: $files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
19: include 'files/phar_test.inc';
20:
21: function err_handler($errno, $errstr, $errfile, $errline) {
22: echo "Catchable fatal error: $errstr in $errfile on line $errline\n";
23: }
24:
25: set_error_handler("err_handler", E_RECOVERABLE_ERROR);
26:
27: $fp = fopen($pname . '/b/new.php', 'wb');
28: fwrite($fp, 'extra');
29: fclose($fp);
30: include $pname . '/b/c.php';
31: include $pname . '/b/new.php';
32: ?>
33:
34: ===DONE===
35: --CLEAN--
36: <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
37: --EXPECTF--
38:
39: Warning: fopen(phar://%sopen_for_write_newfile_b_5_2.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_5_2.php on line %d
40:
41: Warning: fwrite(): supplied argument is not a valid stream resource in %sopen_for_write_newfile_b_5_2.php on line %d
42:
43: Warning: fclose(): supplied argument is not a valid stream resource in %sopen_for_write_newfile_b_5_2.php on line %d
44: This is b/c
45:
46: Warning: include(phar://%sopen_for_write_newfile_b_5_2.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_5_2.phar.php" in %sopen_for_write_newfile_b_5_2.php on line %d
47:
48: Warning: include(): Failed opening 'phar://%sopen_for_write_newfile_b_5_2.phar.php/b/new.php' for inclusion (include_path='%s') in %sopen_for_write_newfile_b_5_2.php on line %d
49:
50: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>