Skip to content

New test case from ed0c0df351 exercises the code it was intended to #10666

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions ext/mbstring/tests/gh10627.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,35 @@
GH-10627 (mb_convert_encoding crashes PHP on Windows)
--EXTENSIONS--
mbstring
--INI--
mbstring.strict_detection=1
--FILE--
<?php

$str = 'S�kinst�llningar';
$str = "S\xF6kinst\xE4llningar";
$data = [$str, 'abc'];
var_dump(mb_convert_encoding($data, 'UTF-8', 'auto'));
$data = [$str => 'abc', 'abc' => 'def'];
var_dump(mb_convert_encoding($data, 'UTF-8', 'auto'));
$data = ['abc' => $str, 'def' => 'abc'];
var_dump(mb_convert_encoding($data, 'UTF-8', 'auto'));

?>
--EXPECT--
array(2) {
[0]=>
string(16) "S?kinst?llningar"
--EXPECTF--
Warning: mb_convert_encoding(): Unable to detect character encoding in %s on line %d
array(1) {
[1]=>
string(3) "abc"
}
array(2) {
["S?kinst?llningar"]=>
string(3) "abc"

Warning: mb_convert_encoding(): Unable to detect character encoding in %s on line %d
array(1) {
["abc"]=>
string(3) "def"
}

Warning: mb_convert_encoding(): Unable to detect character encoding in %s on line %d
array(1) {
["def"]=>
string(3) "abc"
}