1--TEST-- 2Test readdir() with a dir for multibyte filenames 3--SKIPIF-- 4<?php 5include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; 6 7skip_if_not_win(); 8if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); 9skip_if_no_required_exts(); 10 11?> 12--FILE-- 13<?php 14 15include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; 16 17$prefix = create_data("mb_names"); 18$content = ""; 19create_verify_file($prefix, "českýtestování.inc", $content); 20create_verify_file($prefix, "Röd_Statistics.txt", $content); 21create_verify_file($prefix, "š.txt", ""); 22create_verify_file($prefix, "tschüß", $content); 23create_verify_file($prefix, "Voláçao", "hola"); 24create_verify_file($prefix, "Ελλάδα.txt", ""); 25create_verify_file($prefix, "привет", "opened an utf8 filename for reading"); 26create_verify_file($prefix, "テストマルチバイト・パス", $content); 27create_verify_file($prefix, "測試多字節路徑", $content); 28create_verify_file($prefix, "żółć.txt", $content); 29create_verify_dir($prefix, "tschüß3"); 30create_verify_dir($prefix, "Voláçao3"); 31create_verify_dir($prefix, "привет3"); 32create_verify_dir($prefix, "テストマルチバイト・パス42"); 33create_verify_dir($prefix, "測試多字節路徑5"); 34create_verify_dir($prefix, "żółć"); 35 36 37$dirw = $prefix . DIRECTORY_SEPARATOR; 38 39$old_cp = get_active_cp(); 40set_active_cp(65001); 41 42if (is_dir($dirw)) { 43 if ($dh = opendir($dirw)) { 44 while (($file = readdir($dh)) !== false) { 45 echo "filename: $file : filetype: " . filetype($dirw . $file) . "\n"; 46 } 47 closedir($dh); 48 } 49} else { 50 echo "is_dir failed\n"; 51} 52set_active_cp($old_cp); 53 54remove_data("mb_names"); 55 56?> 57===DONE=== 58--EXPECTF-- 59Active code page: 65001 60filename: . : filetype: dir 61filename: .. : filetype: dir 62filename: Röd_Statistics.txt : filetype: file 63filename: tschüß : filetype: file 64filename: tschüß3 : filetype: dir 65filename: Voláçao : filetype: file 66filename: Voláçao3 : filetype: dir 67filename: českýtestování.inc : filetype: file 68filename: š.txt : filetype: file 69filename: żółć : filetype: dir 70filename: żółć.txt : filetype: file 71filename: Ελλάδα.txt : filetype: file 72filename: привет : filetype: file 73filename: привет3 : filetype: dir 74filename: テストマルチバイト・パス : filetype: file 75filename: テストマルチバイト・パス42 : filetype: dir 76filename: 測試多字節路徑 : filetype: file 77filename: 測試多字節路徑5 : filetype: dir 78Active code page: %d 79===DONE=== 80