-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix GH-10627: mb_convert_encoding crashes PHP on Windows
Fixes GH-10627 The php_mb_convert_encoding() function can return NULL on error, but this case was not handled, which led to a NULL pointer dereference and hence a crash. Closes GH-10628 Signed-off-by: George Peter Banyard <girgias@php.net>
- Loading branch information
Showing
3 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--TEST-- | ||
GH-10627 (mb_convert_encoding crashes PHP on Windows) | ||
--EXTENSIONS-- | ||
mbstring | ||
--FILE-- | ||
<?php | ||
|
||
$str = 'Sökinställningar'; | ||
$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')); | ||
|
||
?> | ||
--EXPECTF-- | ||
Warning: mb_convert_encoding(): Unable to detect character encoding in %s on line %d | ||
array(1) { | ||
[1]=> | ||
string(3) "abc" | ||
} | ||
|
||
Warning: mb_convert_encoding(): Unable to detect character encoding in %s on line %d | ||
array(1) { | ||
["abc"]=> | ||
string(3) "def" | ||
} |