1--TEST-- 2Bug #54028 Directory::read() cannot handle non-unicode chars properly 3--EXTENSIONS-- 4mbstring 5--SKIPIF-- 6<?php 7include __DIR__ . DIRECTORY_SEPARATOR . "util.inc"; 8 9skip_if_not_win(); 10if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); 11skip_if_no_required_exts(); 12 13?> 14--FILE-- 15<?php 16 17/* This file is in UTF-8. */ 18 19include __DIR__ . DIRECTORY_SEPARATOR . "util.inc"; 20 21$prefix = __DIR__ . DIRECTORY_SEPARATOR . "testBug54028" . DIRECTORY_SEPARATOR; 22 23$dirs = array("a", "ソ", "ゾ", "şŞıİğĞ", "多国語", "王", "汚れて掘る"); 24 25mkdir($prefix); 26foreach ($dirs as $d) { 27 mkdir($prefix . $d); 28} 29 30$directory = dir($prefix); 31while (false !== ($content = $directory->read())) { 32 if ("." == $content || ".." == $content) continue; 33 34 printf("Returned (%s)\n", $content); 35 printf("Encoding: %s\n", mb_detect_encoding($content)); 36 if ($content != get_basename_with_cp($prefix . $content, 65001, false)) { 37 echo "Verification failed!\n"; 38 } 39 echo "\n"; 40} 41 42foreach ($dirs as $d) { 43 rmdir($prefix . $d); 44} 45rmdir($prefix); 46 47?> 48--EXPECT-- 49Returned (a) 50Encoding: ASCII 51 52Returned (şŞıİğĞ) 53Encoding: UTF-8 54 55Returned (ソ) 56Encoding: UTF-8 57 58Returned (ゾ) 59Encoding: UTF-8 60 61Returned (多国語) 62Encoding: UTF-8 63 64Returned (汚れて掘る) 65Encoding: UTF-8 66 67Returned (王) 68Encoding: UTF-8 69 70