1--TEST-- 2Test is_dir() function: usage variations - invalid arguments 3--FILE-- 4<?php 5/* Prototype: bool is_dir ( string $dirname ); 6 Description: Tells whether the dirname is a directory 7 Returns TRUE if the dirname exists and is a directory, FALSE otherwise. 8*/ 9 10/* Passing invalid arguments to is_dir() */ 11 12$dir_handle = opendir( dirname(__FILE__) ); 13 14echo "*** Testing is_dir() with Invalid arguments: expected bool(false) ***\n"; 15$dirnames = array( 16 /* Invalid dirnames */ 17 -2.34555, 18 TRUE, 19 FALSE, 20 NULL, 21 " ", 22 $dir_handle, 23 24 /* scalars */ 25 0, 26 1234 27); 28 29/* loop through to test each element the above array */ 30foreach($dirnames as $dirname) { 31 var_dump( is_dir($dirname) ); 32} 33closedir($dir_handle); 34 35echo "\n*** Done ***"; 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 50*** Done *** 51 52