1--TEST--
2Test is_dir() function: usage variations - invalid arguments
3--CONFLICTS--
4obscure_filename
5--FILE--
6<?php
7/* Prototype: bool is_dir ( string $dirname );
8   Description: Tells whether the dirname is a directory
9     Returns TRUE if the dirname exists and is a directory, FALSE  otherwise.
10*/
11
12/* Passing invalid arguments to is_dir() */
13
14$dir_handle = opendir( __DIR__ );
15
16echo "*** Testing is_dir() with Invalid arguments: expected bool(false) ***\n";
17$dirnames = array(
18  /* Invalid dirnames */
19  -2.34555,
20  TRUE,
21  FALSE,
22  NULL,
23  " ",
24  $dir_handle,
25
26  /* scalars */
27  0,
28  1234
29);
30
31/* loop through to test each element the above array */
32foreach($dirnames as $dirname) {
33  var_dump( is_dir($dirname) );
34}
35closedir($dir_handle);
36?>
37--EXPECTF--
38*** Testing is_dir() with Invalid arguments: expected bool(false) ***
39bool(false)
40bool(false)
41bool(false)
42bool(false)
43bool(false)
44
45Warning: is_dir() expects parameter 1 to be a valid path, resource given in %s on line %d
46NULL
47bool(false)
48bool(false)
49