1--TEST-- 2Test readdir() function : usage variations - empty directories 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/* 12 * Pass readdir() a directory handle pointing to an empty directory to test behaviour 13 */ 14 15echo "*** Testing readdir() : usage variations ***\n"; 16 17$path = __DIR__ . '/私はガラスを食べられますreaddir_variation2'; 18mkdir($path); 19$dir_handle = opendir($path); 20 21echo "\n-- Pass an empty directory to readdir() --\n"; 22function mysort($a,$b) { 23 return strlen($a) > strlen($b) ? 1 : -1; 24} 25$entries = array(); 26while(FALSE !== ($file = readdir($dir_handle))){ 27 $entries[] = $file; 28} 29 30closedir($dir_handle); 31 32usort($entries, "mysort"); 33foreach($entries as $entry) { 34 var_dump($entry); 35} 36?> 37--CLEAN-- 38<?php 39$path = __DIR__ . '/私はガラスを食べられますreaddir_variation2'; 40rmdir($path); 41?> 42--EXPECT-- 43*** Testing readdir() : usage variations *** 44 45-- Pass an empty directory to readdir() -- 46string(1) "." 47string(2) ".." 48