Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ext/mbstring/libmbfl/filters/mbfilter_cjk.c
Original file line number Diff line number Diff line change
Expand Up @@ -2058,7 +2058,7 @@ static int mbfl_filt_conv_wchar_jis2004_flush(mbfl_convert_filter *filter)
k = filter->cache;
filter->cache = 0;

if (filter->status == 1 && k >= 0 && k <= jisx0213_u2_tbl_len) {
if ((filter->status & 0xf) == 1 && k >= 0 && k < jisx0213_u2_tbl_len) {
s1 = jisx0213_u2_fb_tbl[k];

if (filter->to->no_encoding == mbfl_no_encoding_sjis2004) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
--TEST--
mb_strcut() keeps trailing combining base character in ISO-2022-JP-2004 after JIS X 0213 plane 1
--EXTENSIONS--
mbstring
--FILE--
<?php
$s = mb_convert_encoding("\u{4FF1}か", 'ISO-2022-JP-2004', 'UTF-8');
echo bin2hex($s), "\n";
echo bin2hex(mb_strcut($s, 0, strlen($s), 'ISO-2022-JP-2004')), "\n";
?>
--EXPECT--
1b2428512e21242b1b2842
1b2428512e21242b1b2842
Loading