1--TEST--
2Test fopen() for write CP1251 to UTF-8 path
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--CONFLICTS--
13file_cp1251
14--FILE--
15<?php
16/*
17#vim: set fileencoding=cp1251
18#vim: set encoding=cp1251
19*/
20
21include __DIR__ . DIRECTORY_SEPARATOR . "util.inc";
22
23$item = iconv('cp1251', 'utf-8', "������"); // cp1251 string
24$prefix = create_data("file_cp1251", $item . "7");
25$fn = $prefix . DIRECTORY_SEPARATOR . "${item}7";
26
27$f = fopen($fn, 'w');
28if ($f) {
29	var_dump($f, fwrite($f, "writing to an mb filename"));
30	var_dump(fclose($f));
31} else {
32	echo "open utf8 failed\n";
33}
34
35var_dump(file_get_contents($fn));
36
37get_basename_with_cp($fn, 65001);
38
39var_dump(unlink($fn));
40remove_data("file_cp1251");
41
42?>
43===DONE===
44--EXPECTF--
45resource(%d) of type (stream)
46int(25)
47bool(true)
48string(25) "writing to an mb filename"
49Active code page: 65001
50getting basename of %s\привет7
51string(13) "привет7"
52bool(true)
53string(%d) "%s\привет7"
54Active code page: %d
55bool(true)
56===DONE===
57