1--TEST--
2Test scandir() function : usage variations - Wildcards in directory path
3--SKIPIF--
4<?php
5if (substr(PHP_OS, 0, 3) != 'WIN') {
6  die("skip Valid only on Windows");
7}
8?>
9--FILE--
10<?php
11/* Prototype  : array scandir(string $dir [, int $sorting_order [, resource $context]])
12 * Description: List files & directories inside the specified path
13 * Source code: ext/standard/dir.c
14 */
15
16/*
17 * Pass a directory path using wildcards as $dir argument to test how scandir() behaves
18 */
19
20echo "*** Testing scandir() : usage variations ***\n";
21
22// create the temporary directories
23$file_path = dirname(__FILE__);
24$dir_path = $file_path . "/scandir_variation6";
25$sub_dir_path = $dir_path . "/sub_dir1";
26
27mkdir($dir_path);
28mkdir($sub_dir_path);
29
30// with different wildcard characters
31
32echo "\n-- Wildcard = '*' --\n";
33var_dump( scandir($file_path . "/scandir_var*") );
34var_dump( scandir($file_path . "/*") );
35
36echo "\n-- Wildcard = '?' --\n";
37var_dump( scandir($dir_path . "/sub_dir?") );
38var_dump( scandir($dir_path . "/sub?dir1") );
39
40?>
41===DONE===
42--CLEAN--
43<?php
44$dir_path = dirname(__FILE__) . "/scandir_variation6";
45$sub_dir_path = $dir_path . "/sub_dir1";
46
47rmdir($sub_dir_path);
48rmdir($dir_path);
49?>
50--EXPECTF--
51*** Testing scandir() : usage variations ***
52
53-- Wildcard = '*' --
54
55Warning: scandir(%s/scandir_var*,%s/scandir_var*): No such file or directory in %s on line %d
56
57Warning: scandir(%s/scandir_var*): failed to open dir: No such file or directory in %sscandir_variation6-win32.php on line %d
58
59Warning: scandir(): (errno %d): %s in %s on line %d
60bool(false)
61
62Warning: scandir(%s/*,%s/*): No such file or directory in %s on line %d
63
64Warning: scandir(%s/*): failed to open dir: No such file or directory in %sscandir_variation6-win32.php on line %d
65
66Warning: scandir(): (errno %d): %s in %s on line %d
67bool(false)
68
69-- Wildcard = '?' --
70
71Warning: scandir(%s/scandir_variation6/sub_dir?,%s/scandir_variation6/sub_dir?): No such file or directory in %s on line %d
72
73Warning: scandir(%s/scandir_variation6/sub_dir?): failed to open dir: No such file or directory in %sscandir_variation6-win32.php on line %d
74
75Warning: scandir(): (errno %d): %s in %s on line %d
76bool(false)
77
78Warning: scandir(%s/scandir_variation6/sub?dir1,%s/scandir_variation6/sub?dir1): No such file or directory in %s on line %d
79
80Warning: scandir(%s/scandir_variation6/sub?dir1): failed to open dir: No such file or directory in %sscandir_variation6-win32.php on line %d
81
82Warning: scandir(): (errno %d): %s in %s on line %d
83bool(false)
84===DONE===
85