Skip to content

Commit 15ba73c

Browse files
committed
Add more tests for UTF-8 text conversion
1 parent 51a32cc commit 15ba73c

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

ext/mbstring/tests/utf8_mobile_encodings.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ $badUTF8 = array(
3131
// Multi-byte characters which end too soon and go to ASCII
3232
"\xDFA" => "\x00\x00\x00%\x00\x00\x00A",
3333
"\xEF\xBFA" => "\x00\x00\x00%\x00\x00\x00A",
34+
"\xF0\xBFA" => "\x00\x00\x00%\x00\x00\x00A",
3435
"\xF0\xBF\xBFA" => "\x00\x00\x00%\x00\x00\x00A",
3536

3637
// Multi-byte characters which end too soon and go to another MB char

ext/mbstring/tests/utf_encodings.phpt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -778,13 +778,19 @@ $invalid = array(
778778
// Multi-byte characters which end too soon and go to ASCII
779779
"\xDFA" => "\x00\x00\x00%\x00\x00\x00A",
780780
"\xEF\xBFA" => "\x00\x00\x00%\x00\x00\x00A",
781+
"\xF0\xBFA" => "\x00\x00\x00%\x00\x00\x00A",
781782
"\xF0\xBF\xBFA" => "\x00\x00\x00%\x00\x00\x00A",
782783

783784
// Multi-byte characters which end too soon and go to another MB char
784785
"\xDF\xDF\xBF" => "\x00\x00\x00%\x00\x00\x07\xFF",
785786
"\xEF\xBF\xDF\xBF" => "\x00\x00\x00%\x00\x00\x07\xFF",
786787
"\xF0\xBF\xBF\xDF\xBF" => "\x00\x00\x00%\x00\x00\x07\xFF",
787788

789+
// Multi-byte characters which end too soon and go to a junk byte
790+
// (Which isn't even valid to start a new character)
791+
"\xF0\xBF\xBF\xFF" => "\x00\x00\x00%",
792+
"\xF0\xBF\xFF" => "\x00\x00\x00%",
793+
788794
// Continuation bytes which appear outside of a MB char
789795
"\x80" => "\x00\x00\x00%",
790796
"A\x80" => "\x00\x00\x00A\x00\x00\x00%",

0 commit comments

Comments
 (0)