1--TEST--Bug #64506
2PHP can not read or write file correctly if file name have special char like š
3--SKIPIF--
4<?php
5include __DIR__ . DIRECTORY_SEPARATOR . "util.inc";
6
7skip_if_not_win();
8if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
9skip_if_no_required_exts();
10
11?>
12--FILE--
13<?php
14/*
15#vim: set fileencoding=UTF-8
16#vim: set encoding=UTF-8
17*/
18
19include __DIR__ . DIRECTORY_SEPARATOR . "util.inc";
20
21$fnw = __DIR__ . DIRECTORY_SEPARATOR . "š.txt"; // UTF-8
22
23$f = fopen($fnw, 'w');
24if ($f) {
25    var_dump($f, fwrite($f, "writing to an mb filename"));
26} else {
27    echo "open utf8 failed\n";
28}
29var_dump(fclose($f));
30
31var_dump(file_get_contents($fnw));
32
33get_basename_with_cp($fnw, 65001);
34
35var_dump(unlink($fnw));
36
37?>
38--EXPECTF--
39resource(%d) of type (stream)
40int(25)
41bool(true)
42string(25) "writing to an mb filename"
43Active code page: 65001
44getting basename of %s\š.txt
45string(6) "š.txt"
46bool(true)
47string(%d) "%s\š.txt"
48Active code page: %d
49bool(true)
50