1--TEST-- 2Test opendir() function : usage variations - Different wildcards 3--SKIPIF-- 4<?php 5if (substr(PHP_OS, 0, 3) != 'WIN') { 6 die("skip Valid only on Windows"); 7} 8?> 9--FILE-- 10<?php 11/* Prototype : mixed opendir(string $path[, resource $context]) 12 * Description: Open a directory and return a dir_handle 13 * Source code: ext/standard/dir.c 14 */ 15 16/* 17 * Pass paths containing wildcards to test if opendir() recognises them 18 */ 19 20echo "*** Testing opendir() : usage variations ***\n"; 21// create the temporary directories 22$file_path = __DIR__; 23$dir_path = $file_path . "/opendir_variation6"; 24$sub_dir_path = $dir_path . "/sub_dir1"; 25 26mkdir($dir_path); 27mkdir($sub_dir_path); 28 29// with different wildcard characters 30 31echo "\n-- Wildcard = '*' --\n"; 32var_dump( opendir($file_path . "/opendir_var*") ); 33var_dump( opendir($file_path . "/*") ); 34 35echo "\n-- Wildcard = '?' --\n"; 36var_dump( opendir($dir_path . "/sub_dir?") ); 37var_dump( opendir($dir_path . "/sub?dir1") ); 38 39?> 40===DONE=== 41--CLEAN-- 42<?php 43$dir_path = __DIR__ . "/opendir_variation6"; 44$sub_dir_path = $dir_path . "/sub_dir1"; 45 46rmdir($sub_dir_path); 47rmdir($dir_path); 48?> 49--EXPECTF-- 50*** Testing opendir() : usage variations *** 51 52-- Wildcard = '*' -- 53 54Warning: opendir(%s/opendir_var*): %s in %s on line %d 55 56Warning: opendir(%s/opendir_var*): failed to open dir: %s in %s on line %d 57bool(false) 58 59Warning: opendir(%s/*): %s in %s on line %d 60 61Warning: opendir(%s/*): failed to open dir: %s in %s on line %d 62bool(false) 63 64-- Wildcard = '?' -- 65 66Warning: opendir(%s/opendir_variation6/sub_dir?): %s in %s on line %d 67 68Warning: opendir(%s/opendir_variation6/sub_dir?): failed to open dir: %s in %s on line %d 69bool(false) 70 71Warning: opendir(%s/opendir_variation6/sub?dir1): %s in %s on line %d 72 73Warning: opendir(%s/opendir_variation6/sub?dir1): failed to open dir: %s in %s on line %d 74bool(false) 75===DONE=== 76