1--TEST--
2Bug #64166: quoted-printable-encode stream filter incorrectly discarding whitespace
3--FILE--
4<?php
5
6function test_64166($data) {
7    $fd = fopen('php://temp', 'w+');
8    fwrite($fd, $data);
9    rewind($fd);
10
11    $res = stream_filter_append($fd, 'convert.quoted-printable-encode', STREAM_FILTER_READ, array(
12		'line-break-chars' => "\n",
13		'line-length' => 74
14    ));
15    var_dump(stream_get_contents($fd, -1, 0));
16
17    stream_filter_remove($res);
18
19    rewind($fd);
20    stream_filter_append($fd, 'convert.quoted-printable-encode', STREAM_FILTER_READ, array(
21		'line-break-chars' => "\n",
22		'line-length' => 6
23    ));
24    var_dump(stream_get_contents($fd, -1, 0));
25
26    fclose($fd);
27}
28
29test_64166("FIRST \nSECOND");
30test_64166("FIRST  \nSECOND");
31
32?>
33--EXPECT--
34string(15) "FIRST=20
35SECOND"
36string(19) "FIRST=
37=20
38SECON=
39D"
40string(18) "FIRST=20=20
41SECOND"
42string(24) "FIRST=
43=20=
44=20
45SECON=
46D"
47