1--TEST-- 2Bug #74589 __DIR__ wrong for unicode character, UTF-8 3--SKIPIF-- 4<?php 5if (substr(PHP_OS, 0, 3) != 'WIN' && PHP_OS != 'Linux') { 6 die('skip Linux or Windows only'); 7} 8?> 9--INI-- 10internal_encoding=utf-8 11--FILE-- 12<?php 13/* 14#vim: set fileencoding=utf-8 15#vim: set encoding=utf-8 16*/ 17 18$item = "bug74589_新建文件夹"; // utf-8 string 19$dir = dirname(__FILE__) . DIRECTORY_SEPARATOR . $item; 20$test_file = $dir . DIRECTORY_SEPARATOR . "test.php"; 21 22mkdir($dir); 23 24file_put_contents($test_file, 25"<?php 26 var_dump(__DIR__); 27 var_dump(__FILE__); 28 var_dump(__DIR__ === dirname(__FILE__));"); 29 30$php = getenv('TEST_PHP_EXECUTABLE'); 31 32echo shell_exec("$php -n $test_file"); 33 34?> 35===DONE=== 36--EXPECTF-- 37string(%d) "%sbug74589_新建文件夹" 38string(%d) "%sbug74589_新建文件夹%etest.php" 39bool(true) 40===DONE=== 41--CLEAN-- 42<?php 43 $item = "bug74589_新建文件夹"; // utf-8 string 44 $dir = dirname(__FILE__) . DIRECTORY_SEPARATOR . $item; 45 $test_file = $dir . DIRECTORY_SEPARATOR . "test.php"; 46 unlink($test_file); 47 rmdir($dir); 48?> 49