com php-src: Fix #65483: quoted-printable encode stream filter incorrectly encoding spaces: ext/standard/filters.c
ext/standard/tests/streams/bug65483.phpt
| From: | Anatol Belski | Date: | Wed, 16 Oct 2013 08:11:21 +0000 |
| Subject: | com php-src: Fix #65483: quoted-printable encode stream filter incorrectly encoding spaces: ext/standard/filters.c ext/standard/tests/streams/bug65483.phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-73575@lists.php.net to get a copy of this message | ||
Commit: 674fb578967f5023fe5ed750ba84b6618b38d963
Author: Michael M Slusarz <slusarz@curecanti.org> Tue, 20 Aug 2013 01:07:26 -0600
Committer: Anatol Belski <ab@php.net> Wed, 16 Oct 2013 01:11:21 -0700
Parents: 39c8f8a205ff8ca90ee9ed667faa04d1c0cd1b6c
Branches: str_size_and_int64
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=674fb578967f5023fe5ed750ba84b6618b38d963
Log:
Fix #65483: quoted-printable encode stream filter incorrectly encoding spaces
Bugs:
https://bugs.php.net/65483
Changed paths:
M ext/standard/filters.c
A ext/standard/tests/streams/bug65483.phpt
Diff:
diff --git a/ext/standard/filters.c b/ext/standard/filters.c
index 0ceb372..0c3817d 100644
--- a/ext/standard/filters.c
+++ b/ext/standard/filters.c
@@ -951,7 +951,9 @@ static php_conv_err_t php_conv_qprint_encode_convert(php_conv_qprint_encode *ins
*(pd++) = qp_digits[(c & 0x0f)];
ocnt -= 3;
line_ccnt -= 3;
- trail_ws--;
+ if (trail_ws > 0) {
+ trail_ws--;
+ }
CONSUME_CHAR(ps, icnt, lb_ptr, lb_cnt);
}
}
diff --git a/ext/standard/tests/streams/bug65483.phpt b/ext/standard/tests/streams/bug65483.phpt
new file mode 100644
index 0000000..d214bbb
--- /dev/null
+++ b/ext/standard/tests/streams/bug65483.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Bug #65483: quoted-printable encode stream filter incorrectly encoding spaces
+--FILE--
+<?php
+
+$data = 'a b=c d';
+
+$fd = fopen('php://temp', 'w+');
+fwrite($fd, $data);
+rewind($fd);
+
+$res = stream_filter_append($fd, 'convert.quoted-printable-encode', STREAM_FILTER_READ);
+var_dump(stream_get_contents($fd, -1, 0));
+
+fclose($fd);
+
+?>
+--EXPECT--
+string(9) "a b=3Dc d"