1--TEST-- 2Test opendir() function : usage variations - Different wildcards 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/* 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 = dirname(__FILE__); 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 = dirname(__FILE__) . "/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*): failed to open dir: %s in %s on line %d 55bool(false) 56 57Warning: opendir(%s/*): failed to open dir: %s in %s on line %d 58bool(false) 59 60-- Wildcard = '?' -- 61 62Warning: opendir(%s/opendir_variation6/sub_dir?): failed to open dir: %s in %s on line %d 63bool(false) 64 65Warning: opendir(%s/opendir_variation6/sub?dir1): failed to open dir: %s in %s on line %d 66bool(false) 67===DONE=== 68