diff options
Diffstat (limited to 'ext/mbstring/tests/illformed_utf_sequences.phpt')
-rw-r--r-- | ext/mbstring/tests/illformed_utf_sequences.phpt | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/ext/mbstring/tests/illformed_utf_sequences.phpt b/ext/mbstring/tests/illformed_utf_sequences.phpt index 3b7d431a0e..8f3b97e8ec 100644 --- a/ext/mbstring/tests/illformed_utf_sequences.phpt +++ b/ext/mbstring/tests/illformed_utf_sequences.phpt @@ -4,12 +4,9 @@ Unicode standard conformance test (ill-formed UTF sequences.) <?php extension_loaded('mbstring') or die('skip mbstring not available'); ?> --FILE-- <?php -function chk_enc($str, $n, $enc = "UTF-8", $with_bom = false) { +function chk_enc($str, $n, $enc = "UTF-8") { $src = bin2hex(mb_convert_encoding($str, "UCS-4BE", $enc)); $dst = str_repeat("0000fffd", $n); - if ($with_bom) { - $dst = "0000feff" . $dst; - } if ($dst == $src) { return false; } else { @@ -129,7 +126,7 @@ $out = ''; $cnt = 0; for ($i = 0xd7ff; $i <= 0xe000; ++$i) { $s = chk_enc("\x00\x00\xfe\xff". pack('C4', $i >> 24, ($i >> 16) & 0xff, ($i >> 8) & 0xff, $i & 0xff), - 1, "UTF-32", true); + 1, "UTF-32"); if ($s === false) { $cnt++; } else { @@ -137,13 +134,13 @@ for ($i = 0xd7ff; $i <= 0xe000; ++$i) { } } var_dump($cnt); -var_dump(str_replace("0000feff","",$out)); +var_dump($out); $out = ''; $cnt = 0; for ($i = 0xd7ff; $i <= 0xe000; ++$i) { $s = chk_enc("\xff\xfe\x00\x00". pack('C4', $i & 0xff, ($i >> 8) & 0xff, ($i >> 16) & 0xff, ($i >> 24) & 0xff), - 1, "UTF-32", true); + 1, "UTF-32"); if ($s === false) { $cnt++; } else { @@ -151,7 +148,7 @@ for ($i = 0xd7ff; $i <= 0xe000; ++$i) { } } var_dump($cnt); -var_dump(str_replace("0000feff","",$out)); +var_dump($out); ?> --EXPECT-- @@ -199,10 +196,10 @@ bool(false) string(8) "0010ffff" bool(false) string(8) "0010ffff" -string(16) "0000feff0000fffd" -string(16) "0000feff0010ffff" -string(16) "0000feff0000fffd" -string(16) "0000feff0010ffff" +string(8) "0000fffd" +string(8) "0010ffff" +string(8) "0000fffd" +string(8) "0010ffff" UTF-32 and surrogates area int(2048) string(16) "0000d7ff0000e000" |