Skip to content

Commit 3f9af55

Browse files
slusarzsmalyshev
authored andcommitted
Fix #65483: quoted-printable encode stream filter incorrectly encoding spaces
1 parent 768c34e commit 3f9af55

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

NEWS

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ PHP NEWS
55
- Core:
66
. Fixed bug #65490 (Duplicate calls to get lineno & filename for
77
DTRACE_FUNCTION_*). (Chris Jones)
8+
. Fixed bug #65483 (quoted-printable encode stream filter incorrectly encoding
9+
spaces). (Michael M Slusarz)
810
. Fixed bug #65481 (shutdown segfault due to serialize) (Mike)
911
. Fixed bug #65470 (Segmentation fault in zend_error() with
1012
--enable-dtrace). (Chris Jones, Kris Van Hees)

ext/standard/filters.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -951,7 +951,9 @@ static php_conv_err_t php_conv_qprint_encode_convert(php_conv_qprint_encode *ins
951951
*(pd++) = qp_digits[(c & 0x0f)];
952952
ocnt -= 3;
953953
line_ccnt -= 3;
954-
trail_ws--;
954+
if (trail_ws > 0) {
955+
trail_ws--;
956+
}
955957
CONSUME_CHAR(ps, icnt, lb_ptr, lb_cnt);
956958
}
957959
}
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--TEST--
2+
Bug #65483: quoted-printable encode stream filter incorrectly encoding spaces
3+
--FILE--
4+
<?php
5+
6+
$data = 'a b=c d';
7+
8+
$fd = fopen('php://temp', 'w+');
9+
fwrite($fd, $data);
10+
rewind($fd);
11+
12+
$res = stream_filter_append($fd, 'convert.quoted-printable-encode', STREAM_FILTER_READ);
13+
var_dump(stream_get_contents($fd, -1, 0));
14+
15+
fclose($fd);
16+
17+
?>
18+
--EXPECT--
19+
string(9) "a b=3Dc d"

0 commit comments

Comments
 (0)