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.. Not valid for 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*): failed to open dir: %s in %s on line %d 49bool(false) 50 51Warning: dir(%s/*): failed to open dir: %s in %s on line %d 52bool(false) 53-- wildcard = '?' -- 54 55Warning: dir(%s/dir_variation81/sub_dir?): failed to open dir: %s in %s on line %d 56bool(false) 57 58Warning: dir(%s/dir_variation81/sub?dir1): failed to open dir: %s in %s on line %d 59bool(false) 60Done 61