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