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 = __DIR__ . DIRECTORY_SEPARATOR . $item; 20$test_file = $dir . DIRECTORY_SEPARATOR . "test.php"; 21$test_file_escaped = escapeshellarg($test_file); 22 23mkdir($dir); 24 25file_put_contents($test_file, 26"<?php 27 var_dump(__DIR__); 28 var_dump(__FILE__); 29 var_dump(__DIR__ === __DIR__);"); 30 31$php = getenv('TEST_PHP_EXECUTABLE_ESCAPED'); 32 33echo shell_exec("$php -n $test_file_escaped"); 34 35?> 36--EXPECTF-- 37string(%d) "%sbug74589_新建文件夹" 38string(%d) "%sbug74589_新建文件夹%etest.php" 39bool(true) 40--CLEAN-- 41<?php 42 $item = "bug74589_新建文件夹"; // utf-8 string 43 $dir = __DIR__ . DIRECTORY_SEPARATOR . $item; 44 $test_file = $dir . DIRECTORY_SEPARATOR . "test.php"; 45 unlink($test_file); 46 rmdir($dir); 47?> 48