1--TEST--
2Bug #64166: quoted-printable-encode stream filter incorrectly discarding whitespace - split reads
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    $str = "";
16    while(($c = fread($fd, 1))!= "") $str .= $c;
17    var_dump($str);
18
19    stream_filter_remove($res);
20
21    rewind($fd);
22    stream_filter_append($fd, 'convert.quoted-printable-encode', STREAM_FILTER_READ, array(
23		'line-break-chars' => "\n",
24		'line-length' => 6
25    ));
26    $str = "";
27    while(($c = fread($fd, 1))!= "") $str .= $c;
28    var_dump($str);
29
30    fclose($fd);
31}
32
33test_64166("FIRST \nSECOND");
34test_64166("FIRST  \nSECOND");
35
36?>
37--EXPECT--
38string(15) "FIRST=20
39SECOND"
40string(19) "FIRST=
41=20
42SECON=
43D"
44string(18) "FIRST=20=20
45SECOND"
46string(24) "FIRST=
47=20=
48=20
49SECON=
50D"
51