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