xref: /PHP-5.3/ext/phar/tests/opendir.phpt (revision 228c2886)
1--TEST--
2Phar: test opendir() interception
3--SKIPIF--
4<?php if (!extension_loaded("phar")) die("skip");?>
5--INI--
6phar.require_hash=1
7phar.readonly=0
8detect_unicode=0
9--FILE--
10<?php
11$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
12$a = new Phar($fname);
13$a['index.php'] = '<?php
14$a = opendir("dir");
15if ($a) {
16	while (false !== ($e = readdir($a))) {
17		echo $e;
18	}
19}
20?>';
21$a['dir/file1.txt'] = 'hi';
22$a['dir/file2.txt'] = 'hi2';
23$a['dir/file3.txt'] = 'hi3';
24$a->setStub('<?php
25Phar::interceptFileFuncs();
26set_include_path("phar://" . __FILE__);
27include "index.php";
28__HALT_COMPILER();');
29include $fname;
30echo "\n";
31opendir('phar://');
32opendir('phar://hi.phar');
33?>
34===DONE===
35--CLEAN--
36<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
37--EXPECTF--
38file1.txtfile2.txtfile3.txt
39
40Warning: 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)
41phar url "phar://" is unknown in %sopendir.php on line %d
42
43Warning: opendir(phar://hi.phar): failed to open dir: phar error: invalid url or non-existent phar "phar://hi.phar"
44phar url "phar://hi.phar" is unknown in %sopendir.php on line %d
45===DONE===
46