Annotation of embedaddon/php/ext/phar/tests/fopen_edgecases2U.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Phar: test edge cases of fopen() function interception #2 (PHP 6)
3: --SKIPIF--
4: <?php if (!extension_loaded("phar")) die("skip"); ?>
5: <?php if (version_compare(PHP_VERSION, "6.0.0-dev", "<")) die("skip Unicode support required"); ?>
6: --INI--
7: phar.readonly=0
8: --FILE--
9: <?php
10: Phar::interceptFileFuncs();
11: $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
12: $pname = 'phar://' . $fname;
13:
14: fopen(array(), 'r');
15: chdir(dirname(__FILE__));
16: file_put_contents($fname, b"blah\n");
17: file_put_contents("foob", b"test\n");
18: $a = fopen($fname, 'rb');
19: echo fread($a, 1000);
20: fclose($a);
21: unlink($fname);
22: mkdir($pname . '/oops');
23: file_put_contents($pname . '/foo/hi', b'<?php
24: $context = stream_context_create();
25: $a = fopen("foob", "rb", false, $context);
26: echo fread($a, 1000);
27: fclose($a);
28: fopen("../oops", "r");
29: ?>
30: ');
31: include $pname . '/foo/hi';
32: ?>
33: ===DONE===
34: --CLEAN--
35: <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
36: <?php rmdir(dirname(__FILE__) . '/poo'); ?>
37: <?php unlink(dirname(__FILE__) . '/foob'); ?>
38: --EXPECTF--
39: Notice: Array to string conversion in %sfopen_edgecases2U.php on line 6
40:
41: Warning: fopen(Array): failed to open stream: No such file or directory in %sfopen_edgecases2U.php on line 6
42: blah
43: test
44:
45: Warning: fopen(phar://%sfopen_edgecases2U.phar.php/oops): failed to open stream: phar error: path "oops" is a directory in phar://%sfopen_edgecases2U.phar.php/foo/hi on line 6
46: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>