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