1--TEST--
2Test is_dir() function: usage variations - diff. path notations
3--FILE--
4<?php
5/* Passing dir names with different notations, using slashes, wild-card chars */
6
7$file_path = __DIR__;
8
9echo "*** Testing is_dir() with different notations of dir names ***";
10$dir_name = "/is_dir_variation4";
11mkdir($file_path.$dir_name);
12
13$dirs_arr = array(
14  "is_dir_variation4",
15  "./is_dir_variation4",
16
17  /* Testing a file trailing slash */
18  "is_dir_variation4/",
19  "./is_dir_variation4/",
20
21  /* Testing file with double trailing slashes */
22  "is_dir_variation4//",
23  "./is_dir_variation4//",
24  ".//is_dir_variation4//",
25  "is_dir_vari*",
26
27  /* Testing Binary safe */
28  "./is_dir_variation4/".chr(0),
29  "is_dir_variation4\0"
30);
31
32$count = 1;
33/* loop through to test each element the above array */
34foreach($dirs_arr as $dir) {
35  echo "\n-- Iteration $count --\n";
36  try {
37    var_dump( is_dir($file_path."/".$dir ) );
38  } catch (Error $e) {
39    echo $e->getMessage(), "\n";
40  }
41  $count++;
42}
43
44echo "\n*** Done ***";
45?>
46--CLEAN--
47<?php
48$file_path = __DIR__;
49$dir_name = $file_path."/is_dir_variation4";
50rmdir($dir_name);
51?>
52--EXPECT--
53*** Testing is_dir() with different notations of dir names ***
54-- Iteration 1 --
55bool(true)
56
57-- Iteration 2 --
58bool(true)
59
60-- Iteration 3 --
61bool(true)
62
63-- Iteration 4 --
64bool(true)
65
66-- Iteration 5 --
67bool(true)
68
69-- Iteration 6 --
70bool(true)
71
72-- Iteration 7 --
73bool(true)
74
75-- Iteration 8 --
76bool(false)
77
78-- Iteration 9 --
79bool(false)
80
81-- Iteration 10 --
82bool(false)
83
84*** Done ***
85