Skip to content

Commit 9c3972f

Browse files
committed
Fix legacy conversion filter for HZ
1 parent 1526bab commit 9c3972f

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

ext/mbstring/libmbfl/filters/mbfilter_hz.c

+1
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ int mbfl_filt_conv_hz_wchar(int c, mbfl_convert_filter *filter)
130130
filter->status = 0x10;
131131
} else if (c == '~' && filter->status == 2) {
132132
CK((*filter->output_function)('~', filter->data));
133+
filter->status -= 2;
133134
} else if (c == '\n') {
134135
/* "~\n" is a line continuation; no output is needed, nor should we shift modes */
135136
filter->status -= 2;

ext/mbstring/tests/hz_encoding.phpt

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ testValidString('~~', '~', 'HZ', 'ASCII');
3333
testValidString("~\n", '', 'HZ', 'ASCII', false);
3434
testValidString('~{~}', '', 'HZ', 'ASCII', false);
3535
testValidString("~{~\n~}", '', 'HZ', 'ASCII', false);
36+
testValidString('~~?', '~?', 'HZ', 'ASCII');
3637
echo "Tested valid ~ escapes\n";
3738

3839
for ($i = 0; $i < 0xFF; $i++) {

0 commit comments

Comments
 (0)