Skip to content

Commit d499720

Browse files
committed
Merge branch 'PHP-7.1'
* PHP-7.1: add test for bug #74589
2 parents a33aca5 + 71f8c4d commit d499720

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
--TEST--
2+
Bug #74589 __DIR__ wrong for unicode character, UTF-8
3+
--SKIPIF--
4+
<?php
5+
if (substr(PHP_OS, 0, 3) != 'WIN' || PHP_OS != 'Linux') {
6+
die('skip Linux or Windows only');
7+
}
8+
?>
9+
--INI--
10+
internal_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+
22+
mkdir($dir);
23+
24+
file_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+
32+
echo shell_exec("$php -n $test_file");
33+
34+
?>
35+
===DONE===
36+
--EXPECTF--
37+
string(%d) "%sbug74589_新建文件夹"
38+
string(%d) "%sbug74589_新建文件夹\test.php"
39+
bool(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+

0 commit comments

Comments
 (0)