Annotation of embedaddon/php/ext/phar/tests/opendir.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Phar: test opendir() interception
3: --SKIPIF--
4: <?php if (!extension_loaded("phar")) die("skip");?>
5: --INI--
6: phar.require_hash=1
7: phar.readonly=0
8: --FILE--
9: <?php
10: $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
11: $a = new Phar($fname);
12: $a['index.php'] = '<?php
13: $a = opendir("dir");
14: if ($a) {
15: while (false !== ($e = readdir($a))) {
16: echo $e;
17: }
18: }
19: ?>';
20: $a['dir/file1.txt'] = 'hi';
21: $a['dir/file2.txt'] = 'hi2';
22: $a['dir/file3.txt'] = 'hi3';
23: $a->setStub('<?php
24: Phar::interceptFileFuncs();
25: set_include_path("phar://" . __FILE__);
26: include "index.php";
27: __HALT_COMPILER();');
28: include $fname;
29: echo "\n";
30: opendir('phar://');
31: opendir('phar://hi.phar');
32: ?>
33: ===DONE===
34: --CLEAN--
35: <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
36: --EXPECTF--
37: file1.txtfile2.txtfile3.txt
38:
39: Warning: opendir(phar://): failed to open dir: phar error: no directory in "phar://", must have at least phar:/// for root directory (always use full path to a new phar)
40: phar url "phar://" is unknown in %sopendir.php on line %d
41:
42: Warning: opendir(phar://hi.phar): failed to open dir: phar error: invalid url or non-existent phar "phar://hi.phar"
43: phar url "phar://hi.phar" is unknown in %sopendir.php on line %d
44: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>