1--TEST-- 2Bug #64699 is_dir() is inaccurate result on Windows with japanese locale. 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 15/* This file is in UTF-8. */ 16 17include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; 18 19$old_cp = get_active_cp(); 20set_active_cp(65001); 21 22$prefix = dirname(__FILE__) . DIRECTORY_SEPARATOR . "testBug64699" . DIRECTORY_SEPARATOR; 23 24$dirs = array("a", "ソ", "ゾ", "şŞıİğĞ", "多国語", "表"); 25 26mkdir($prefix); 27foreach ($dirs as $d) { 28 mkdir($prefix . $d); 29} 30 31$dir = $prefix; 32if ($dh = opendir($dir)) { 33 while (($file = readdir($dh)) !== false) { 34 $path = $dir . $file; 35 $type = filetype($path); 36 $type2= is_dir($path) ? 'dir' : 'file'; 37 $comp = $type == $type2 ? 'OK' : 'NG'; 38 echo "filetype()[".str_pad($type, 4)."] == is_dir()[".str_pad($type2, 4)."] -> $comp: {$file}\n"; 39 } 40 closedir($dh); 41} 42 43foreach ($dirs as $d) { 44 rmdir($prefix . $d); 45} 46rmdir($prefix); 47 48set_active_cp($old_cp); 49 50?> 51===DONE=== 52--EXPECTF-- 53Active code page: 65001 54filetype()[dir ] == is_dir()[dir ] -> OK: . 55filetype()[dir ] == is_dir()[dir ] -> OK: .. 56filetype()[dir ] == is_dir()[dir ] -> OK: a 57filetype()[dir ] == is_dir()[dir ] -> OK: şŞıİğĞ 58filetype()[dir ] == is_dir()[dir ] -> OK: ソ 59filetype()[dir ] == is_dir()[dir ] -> OK: ゾ 60filetype()[dir ] == is_dir()[dir ] -> OK: 多国語 61filetype()[dir ] == is_dir()[dir ] -> OK: 表 62Active code page: %d 63===DONE=== 64