Skip to content

Commit 3142829

Browse files
committed
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1: Propagate error checks for mbfl_filt_conv_illegal_output() Use CK() macro to check the output function in mbfilter_unicode2sjis_emoji_sb() Make error checks on encoding methods for docomo, kddi, sb consistent
2 parents 7934a0f + d66ca5d commit 3142829

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

ext/mbstring/libmbfl/filters/mbfilter_7bit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ int mbfl_filt_conv_any_7bit(int c, mbfl_convert_filter *filter)
7979
if (c >= 0 && c < 0x80) {
8080
CK((*filter->output_function)(c, filter->data));
8181
} else {
82-
mbfl_filt_conv_illegal_output(c, filter);
82+
CK(mbfl_filt_conv_illegal_output(c, filter));
8383
}
8484
return 0;
8585
}

ext/mbstring/libmbfl/filters/mbfilter_iso2022jp_mobile.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ static int mbfl_filt_conv_wchar_2022jp_mobile(int c, mbfl_convert_filter *filter
414414
}
415415
}
416416

417-
if (mbfilter_unicode2sjis_emoji_kddi(c, &s1, filter)) {
417+
if (mbfilter_unicode2sjis_emoji_kddi(c, &s1, filter) > 0) {
418418
/* A KDDI emoji was detected and stored in s1 */
419419
CODE2JIS(c1,c2,s1,s2);
420420
s1 -= 0x1600;

ext/mbstring/libmbfl/filters/mbfilter_sjis_mobile.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ int mbfilter_unicode2sjis_emoji_kddi(int c, int *s1, mbfl_convert_filter *filter
467467

468468
/* If none of the KDDI national flag emoji matched, then we have no way
469469
* to convert the previous codepoint... */
470-
mbfl_filt_conv_illegal_output(c1, filter);
470+
CK(mbfl_filt_conv_illegal_output(c1, filter));
471471
}
472472

473473
if (c == '#' || (c >= '0' && c <= '9')) {
@@ -523,7 +523,7 @@ int mbfilter_unicode2sjis_emoji_sb(int c, int *s1, mbfl_convert_filter *filter)
523523
}
524524
return 1;
525525
} else {
526-
(*filter->output_function)(c1, filter->data);
526+
CK((*filter->output_function)(c1, filter->data));
527527
}
528528
} else if (filter->status == 2) {
529529
int c1 = filter->cache;
@@ -539,7 +539,7 @@ int mbfilter_unicode2sjis_emoji_sb(int c, int *s1, mbfl_convert_filter *filter)
539539

540540
/* If none of the SoftBank national flag emoji matched, then we have no way
541541
* to convert the previous codepoint... */
542-
mbfl_filt_conv_illegal_output(c1, filter);
542+
CK(mbfl_filt_conv_illegal_output(c1, filter));
543543
}
544544

545545
if (c == '#' || (c >= '0' && c <= '9')) {
@@ -814,9 +814,9 @@ int mbfl_filt_conv_wchar_sjis_mobile(int c, mbfl_convert_filter *filter)
814814
}
815815
}
816816

817-
if ((filter->to == &mbfl_encoding_sjis_docomo && mbfilter_unicode2sjis_emoji_docomo(c, &s1, filter)) ||
818-
(filter->to == &mbfl_encoding_sjis_kddi && mbfilter_unicode2sjis_emoji_kddi(c, &s1, filter)) ||
819-
(filter->to == &mbfl_encoding_sjis_sb && mbfilter_unicode2sjis_emoji_sb(c, &s1, filter))) {
817+
if ((filter->to == &mbfl_encoding_sjis_docomo && mbfilter_unicode2sjis_emoji_docomo(c, &s1, filter) > 0) ||
818+
(filter->to == &mbfl_encoding_sjis_kddi && mbfilter_unicode2sjis_emoji_kddi(c, &s1, filter) > 0) ||
819+
(filter->to == &mbfl_encoding_sjis_sb && mbfilter_unicode2sjis_emoji_sb(c, &s1, filter) > 0)) {
820820
s1 = (((s1 / 94) + 0x21) << 8) | ((s1 % 94) + 0x21);
821821
}
822822

@@ -850,7 +850,7 @@ int mbfl_filt_conv_sjis_mobile_flush(mbfl_convert_filter *filter)
850850
} else if (filter->status == 2) {
851851
/* First of a pair of Regional Indicator codepoints came at the end of a string */
852852
filter->cache = filter->status = 0;
853-
mbfl_filt_conv_illegal_output(c1, filter);
853+
CK(mbfl_filt_conv_illegal_output(c1, filter));
854854
}
855855

856856
if (filter->flush_function) {

0 commit comments

Comments
 (0)