1--TEST--
2Test dir() function : usage variations - non-existent directory
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 * Passing a non-existent directory as argument to dir() function
13 * and checking to see if proper warning message is output.
14 */
15echo "*** Testing dir() : open a non-existent directory ***\n";
16
17// create the temporary directory
18$file_path = __DIR__;
19$dir_path = $file_path."/dir_variation6";
20@mkdir($dir_path);
21
22// open existent directory
23$d = dir($dir_path);
24$d->close(); //close the dir
25
26// remove directory and try to open the same(non-existent) directory again
27rmdir($dir_path);
28clearstatcache();
29
30echo "-- opening previously removed directory --\n";
31var_dump( dir($dir_path) );
32
33// point to a non-existent directory
34$non_existent_dir = $file_path."/non_existent_dir";
35echo "-- opening non-existent directory --\n";
36$d = dir($non_existent_dir);
37var_dump( $d );
38
39echo "Done";
40?>
41--EXPECTF--
42*** Testing dir() : open a non-existent directory ***
43-- opening previously removed directory --
44
45Warning: dir(%s): Failed to open directory: %s in %s on line %d
46bool(false)
47-- opening non-existent directory --
48
49Warning: dir(%s): Failed to open directory: %s in %s on line %d
50bool(false)
51Done
52