xref: /php-src/ext/mbstring/tests/gh10627.phpt (revision e934c5cd)
1--TEST--
2GH-10627 (mb_convert_encoding crashes PHP on Windows)
3--EXTENSIONS--
4mbstring
5--INI--
6mbstring.strict_detection=1
7--FILE--
8<?php
9
10$str = "S\xF6kinst\xE4llningar";
11$data = [$str, 'abc'];
12var_dump(mb_convert_encoding($data, 'UTF-8', 'auto'));
13$data = [$str => 'abc', 'abc' => 'def'];
14var_dump(mb_convert_encoding($data, 'UTF-8', 'auto'));
15$data = ['abc' => $str, 'def' => 'abc'];
16var_dump(mb_convert_encoding($data, 'UTF-8', 'auto'));
17
18?>
19--EXPECTF--
20Warning: mb_convert_encoding(): Unable to detect character encoding in %s on line %d
21array(1) {
22  [1]=>
23  string(3) "abc"
24}
25
26Warning: mb_convert_encoding(): Unable to detect character encoding in %s on line %d
27array(1) {
28  ["abc"]=>
29  string(3) "def"
30}
31
32Warning: mb_convert_encoding(): Unable to detect character encoding in %s on line %d
33array(1) {
34  ["def"]=>
35  string(3) "abc"
36}
37