-
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-9008: mb_detect_encoding(): wrong results with null $encodings
Passing `null` to `$encodings` is supposed to behave like passing the result of `mb_detect_order()`. Therefore, we need to remove the non- encodings from the `elist` in this case as well. Thus, we duplicate the global `elist`, so we can modify it. Closes GH-9063.
- Loading branch information
Showing
3 changed files
with
41 additions
and
14 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,24 @@ | ||
--TEST-- | ||
GH-9008 (mb_detect_encoding(): wrong results with null $encodings) | ||
--EXTENSIONS-- | ||
mbstring | ||
--FILE-- | ||
<?php | ||
$string = "<?php | ||
function test() | ||
{ | ||
} | ||
"; | ||
|
||
mb_detect_order(["ASCII", "UUENCODE"]); | ||
|
||
var_dump( | ||
mb_detect_encoding($string, null, true), | ||
mb_detect_encoding($string, mb_detect_order(), true), | ||
); | ||
?> | ||
--EXPECT-- | ||
string(5) "ASCII" | ||
string(5) "ASCII" |