-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
I fixed from strcasecmp to strncasecmp. However, strncasecmp is specify size to #3 parameter. Hence, Add check length to mime and aliases. Co-authored-by: Niels Dossche <[email protected]>
- Loading branch information
1 parent
db54576
commit dc5f3b9
Showing
2 changed files
with
39 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--TEST-- | ||
GH-15824 (ValueError: mb_detect_encoding(): Argument #2 ($encodings) contains invalid encoding "UTF8") | ||
--EXTENSIONS-- | ||
mbstring | ||
--FILE-- | ||
<?php | ||
echo "== alias name ==\n"; | ||
var_dump(mb_detect_encoding('abc', 'UTF8, ASCII')); | ||
var_dump(mb_detect_encoding('こんにちは', 'UTF8, ASCII')); | ||
var_dump(mb_detect_encoding('こんにちは', 'ASCII, UTF8')); | ||
var_dump(mb_detect_encoding("\xC5", 'US-ASCII, LATIN4')); | ||
var_dump(mb_detect_encoding("\xC5", 'US-ASCII, cyrillic')); | ||
/* 0x9D is not located in CP1254 */ | ||
var_dump(mb_detect_encoding("\x9D", 'US-ASCII, CP1254, cyrillic')); | ||
var_dump(mb_detect_encoding("\x9D", 'US-ASCII, CP1254, cyrillic', false)); | ||
|
||
echo "== mime name ==\n"; | ||
var_dump(mb_detect_encoding('abc', 'ANSI_X3.4-1968, ISO-8859-1')); | ||
var_dump(mb_detect_encoding('abc', 'CP50220, ANSI_X3.4-1968')); | ||
/* last comma is not mistake, intentionally */ | ||
var_dump(mb_detect_encoding(bin2hex('1b24422422242424262428242a1b2842'), 'CP50220, ANSI_X3.4-1968,', false)); | ||
var_dump(mb_detect_encoding('😄', 'US-ASCII, UTF-8-Mobile#KDDI-B, UTF-8')); | ||
?> | ||
--EXPECT-- | ||
== alias name == | ||
string(5) "UTF-8" | ||
string(5) "UTF-8" | ||
string(5) "UTF-8" | ||
string(10) "ISO-8859-4" | ||
string(10) "ISO-8859-5" | ||
string(10) "ISO-8859-5" | ||
string(10) "ISO-8859-5" | ||
== mime name == | ||
string(5) "ASCII" | ||
string(7) "CP50220" | ||
string(7) "CP50220" | ||
string(19) "UTF-8-Mobile#KDDI-B" |
dc5f3b9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@youkidearitai You forgot to add a NEWS entry ;)
dc5f3b9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Created PR #15835 .