1--TEST-- 2Bug #75063 Many filesystem-related functions do not work with multibyte file names, cp1251 3--SKIPIF-- 4<?php 5include __DIR__ . 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--INI-- 13default_charset=cp1251 14--FILE-- 15<?php 16 17/* This file is in cp1251. */ 18 19include __DIR__ . DIRECTORY_SEPARATOR . "util.inc"; 20 21$dir_basename = "����"; 22$prefix = __DIR__ . DIRECTORY_SEPARATOR . "bug75063-cp1251"; 23$d0 = $prefix . DIRECTORY_SEPARATOR . $dir_basename; 24 25mkdir($prefix); 26create_verify_dir($prefix, $dir_basename, 1251); 27 28var_dump(get_basename_with_cp($d0, 1251, false)); 29 30$old_cwd = getcwd(); 31var_dump(chdir($d0)); 32 33$code = <<<CODE 34<?php 35 36foreach(["test", "����"] as \$fn) { 37 file_put_contents("\$fn.txt", ""); 38} 39 40var_dump(getcwd()); 41if (\$dh = opendir(getcwd())) { 42 while ((\$file = readdir(\$dh)) !== false) { 43 if ("." == \$file || ".." == \$file) continue; 44 var_dump(\$file); 45 } 46 closedir(\$dh); 47} 48CODE; 49$code_fn = "code.php"; 50file_put_contents($code_fn, $code); 51 52print(shell_exec(getenv('TEST_PHP_EXECUTABLE_ESCAPED') . " -n -d default_charset=cp1251 -f code.php")); 53 54chdir($old_cwd); 55 56/*--CLEAN-- section were the right place, but it won't accept default_charset ATM, it seems. */ 57$dir_basename = "����"; 58$prefix = __DIR__ . DIRECTORY_SEPARATOR . "bug75063-cp1251"; 59$d0 = $prefix . DIRECTORY_SEPARATOR . $dir_basename; 60 61$obj = scandir($d0); 62foreach ($obj as $file) { 63 if ("." == $file || ".." == $file) continue; 64 unlink($d0 . DIRECTORY_SEPARATOR . $file); 65} 66 67rmdir($d0); 68rmdir($prefix); 69?> 70--EXPECTF-- 71string(4) "����" 72bool(true) 73string(%d) "%sbug75063-cp1251%e����" 74string(8) "code.php" 75string(8) "test.txt" 76string(8) "����.txt" 77