summaryrefslogtreecommitdiff
path: root/ext/standard
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2013-08-24 19:48:41 -0700
committerStanislav Malyshev <stas@php.net>2013-08-24 19:49:27 -0700
commitbdccf0a61d9a3979136930aef4b5ba4f601aa03d (patch)
treecd4908eaaaacadd64893ac4330cfe072f3287e12 /ext/standard
parent716fc80fda937bedba786445d6b1854c48af12f8 (diff)
parent3f9af558e78c9904f72933dfb3c735a9d2119b52 (diff)
downloadphp-git-bdccf0a61d9a3979136930aef4b5ba4f601aa03d.tar.gz
Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4: Fix #65483: quoted-printable encode stream filter incorrectly encoding spaces Update NEWS
Diffstat (limited to 'ext/standard')
-rw-r--r--ext/standard/filters.c4
-rw-r--r--ext/standard/tests/streams/bug65483.phpt19
2 files changed, 22 insertions, 1 deletions
diff --git a/ext/standard/filters.c b/ext/standard/filters.c
index 0a59039635..15dae1bee6 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 0000000000..d214bbbbcc
--- /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"