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