xref: /PHP-8.1/ext/standard/tests/dir/bug73877.phpt (revision f8d79582)
1--TEST--
2Bug #73877 readlink() returns garbage for UTF-8 paths
3File type functions
4--SKIPIF--
5<?php
6if (substr(PHP_OS, 0, 3) != 'WIN') {
7    die('skip only for Windows');
8}
9?>
10--FILE--
11<?php
12
13$base = __DIR__ . DIRECTORY_SEPARATOR . "bug73877";
14$dir0 = $base . DIRECTORY_SEPARATOR . "bug73877";
15$dir1 = $base . DIRECTORY_SEPARATOR . "Серёжка";
16$junk0 = $base . DIRECTORY_SEPARATOR . "Серёжка2";
17
18mkdir($base);
19mkdir($dir0);
20mkdir($dir1);
21`mklink /J $junk0 $dir0`;
22
23var_dump(
24    readlink($dir0),
25    readlink($dir1),
26    readlink($junk0),
27    strlen(readlink($dir0)) === strlen(readlink($junk0))
28);
29
30?>
31--CLEAN--
32<?php
33
34$base = __DIR__ . DIRECTORY_SEPARATOR . "bug73877";
35$dir0 = $base . DIRECTORY_SEPARATOR . "bug73877";
36$dir1 = $base . DIRECTORY_SEPARATOR . "Серёжка";
37$junk0 = $base . DIRECTORY_SEPARATOR . "Серёжка2";
38
39rmdir($junk0);
40rmdir($dir0);
41rmdir($dir1);
42rmdir($base);
43
44?>
45--EXPECTF--
46string(%d) "%sbug73877"
47string(%d) "%sСерёжка"
48string(%d) "%sbug73877"
49bool(true)
50