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.. Not valid for Windows');
7}
8?>
9--FILE--
10<?php
11/*
12 * Pass a directory path using wildcards as $dir argument to test how scandir() behaves
13 */
14
15echo "*** Testing scandir() : usage variations ***\n";
16
17// create the temporary directories
18$file_path = __DIR__;
19$dir_path = $file_path . "/scandir_variation6";
20$sub_dir_path = $dir_path . "/sub_dir1";
21
22mkdir($dir_path);
23mkdir($sub_dir_path);
24
25// with different wildcard characters
26
27echo "\n-- Wildcard = '*' --\n";
28var_dump( scandir($file_path . "/scandir_var*") );
29var_dump( scandir($file_path . "/*") );
30
31echo "\n-- Wildcard = '?' --\n";
32var_dump( scandir($dir_path . "/sub_dir?") );
33var_dump( scandir($dir_path . "/sub?dir1") );
34
35?>
36--CLEAN--
37<?php
38$dir_path = __DIR__ . "/scandir_variation6";
39$sub_dir_path = $dir_path . "/sub_dir1";
40
41rmdir($sub_dir_path);
42rmdir($dir_path);
43?>
44--EXPECTF--
45*** Testing scandir() : usage variations ***
46
47-- Wildcard = '*' --
48
49Warning: scandir(%s/scandir_var*): Failed to open directory: %s in %s on line %d
50
51Warning: scandir(): (errno %d): %s in %s on line %d
52bool(false)
53
54Warning: scandir(%s/*): Failed to open directory: %s in %s on line %d
55
56Warning: scandir(): (errno %d): %s in %s on line %d
57bool(false)
58
59-- Wildcard = '?' --
60
61Warning: scandir(%s/scandir_variation6/sub_dir?): Failed to open directory: %s in %s on line %d
62
63Warning: scandir(): (errno %d): %s in %s on line %d
64bool(false)
65
66Warning: scandir(%s/scandir_variation6/sub?dir1): Failed to open directory: %s in %s on line %d
67
68Warning: scandir(): (errno %d): %s in %s on line %d
69bool(false)
70