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