1--TEST--
2Test fopen() for write cp936 to UTF-8 path
3--SKIPIF--
4<?php
5include dirname(__FILE__) . 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=cp936
16#vim: set encoding=cp936
17*/
18
19include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc";
20
21$item = iconv('cp936', 'utf-8', "�yԇ���ֹ�·��"); // cp936 string
22$prefix = create_data("file_cp936", $item . "25");
23$fn = $prefix . DIRECTORY_SEPARATOR . "{$item}25";
24
25$f = fopen($fn, 'w');
26if ($f) {
27	var_dump($f, fwrite($f, "writing to an mb filename"));
28	var_dump(fclose($f));
29} else {
30	echo "open utf8 failed\n";
31}
32
33var_dump(file_get_contents($fn));
34
35get_basename_with_cp($fn, 65001);
36
37var_dump(unlink($fn));
38
39remove_data("file_cp936");
40
41?>
42===DONE===
43--EXPECTF--
44resource(%d) of type (stream)
45int(25)
46bool(true)
47string(25) "writing to an mb filename"
48Active code page: 65001
49getting basename of %s\測試多字節路徑25
50string(23) "測試多字節路徑25"
51bool(true)
52string(%d) "%s\測試多字節路徑25"
53Active code page: %d
54bool(true)
55===DONE===
56