1--TEST--
2Test dir() function : usage variations - checking with wildcard characters
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/*
12 * Prototype  : object dir(string $directory[, resource $context])
13 * Description: Directory class with properties, handle and class and methods read, rewind and close
14 * Source code: ext/standard/dir.c
15 */
16
17/*
18 * Create more than one temporary directory & subdirectory and check if dir() function can open
19 * those directories when wildcard characters are used to refer to them.
20 */
21
22echo "*** Testing dir() : checking with wildcard characters ***\n";
23
24// create the temporary directories
25$file_path = dirname(__FILE__);
26$dir_path = $file_path."/dir_variation81";
27$sub_dir_path = $dir_path."/sub_dir1";
28
29@mkdir($dir_path1);
30@mkdir($sub_dir_path);
31
32/* with different wildcard characters */
33
34echo "-- wildcard = '*' --\n";
35var_dump( dir($file_path."/dir_var*") );
36var_dump( dir($file_path."/*") );
37
38echo "-- wildcard = '?' --\n";
39var_dump( dir($dir_path."/sub_dir?") );
40var_dump( dir($dir_path."/sub?dir1") );
41
42echo "Done";
43?>
44--EXPECTF--
45*** Testing dir() : checking with wildcard characters ***
46-- wildcard = '*' --
47
48Warning: dir(%s/dir_var*,%s/dir_var*): %r(No such file or directory|The system cannot find the path specified. \(code: 3\))%r in %s on line %d
49
50Warning: dir(%s/dir_var*): failed to open dir: %s in %s on line %d
51bool(false)
52
53Warning: dir(%s/*,%s/*): %r(No such file or directory|The system cannot find the path specified. \(code: 3\))%r in %s on line %d
54
55Warning: dir(%s/*): failed to open dir: %s in %s on line %d
56bool(false)
57-- wildcard = '?' --
58
59Warning: dir(%s/dir_variation81/sub_dir?,%s/dir_variation81/sub_dir?): %r(No such file or directory|The system cannot find the path specified. \(code: 3\))%r in %s on line %d
60
61Warning: dir(%s/dir_variation81/sub_dir?): failed to open dir: %s in %s on line %d
62bool(false)
63
64Warning: dir(%s/dir_variation81/sub?dir1,%s/dir_variation81/sub?dir1): %r(No such file or directory|The system cannot find the path specified. \(code: 3\))%r in %s on line %d
65
66Warning: dir(%s/dir_variation81/sub?dir1): failed to open dir: %s in %s on line %d
67bool(false)
68Done
69