Bug #64166 [Opn]: quoted-printable-encode stream filter incorrectly discarding whitespace

From: Date: Thu, 07 Feb 2013 01:14:58 +0000
Subject: Bug #64166 [Opn]: quoted-printable-encode stream filter incorrectly discarding whitespace
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-176499@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=64166&edit=1

 ID:                 64166
 User updated by:    slusarz at curecanti dot org
 Reported by:        slusarz at curecanti dot org
 Summary:            quoted-printable-encode stream filter incorrectly
                     discarding whitespace
 Status:             Open
 Type:               Bug
-Package:            Filter related
+Package:            Streams related
 Operating System:   Linux
 PHP Version:        5.4.11
 Block user comment: N
 Private report:     N

 New Comment:

Just kidding... apparently there's a difference between "filter" and "stream
filter".  Sorry for the noise.


Previous Comments:
------------------------------------------------------------------------
[2013-02-07 01:14:09] slusarz at curecanti dot org

This is actually a stream *filter* issue, so put in filter queue.

------------------------------------------------------------------------
[2013-02-07 00:49:44] slusarz at curecanti dot org

Description:
------------
The QP stream filter is incorrectly discarding whitespace at the end of the lines.  The
quoted_printable_encode() method does not have this issue.

This is troublesome when attempting to save flowed text/plain data, as it causes the data to lose
its flowed formatting.  (I realize that RFC 3676 says flowed text SHOULD NOT be encoded in QP, but
this is an (arguably) outdated policy restriction and not a technical restriction).

Test script:
---------------
<?php

$data = "FIRST \r\nSECOND";

$fp = fopen('php://temp', 'w+');
stream_filter_append($fp, 'convert.quoted-printable-encode', STREAM_FILTER_WRITE, array(
    'line-length' => 76
));
fwrite($fp, $data);
rewind($fp);

print quoted_printable_encode($data) . "\n";
print stream_get_contents($fp);

Expected result:
----------------
FIRST=20
SECOND
FIRST=20
SECOND

Actual result:
--------------
FIRST=20
SECOND
FIRST
SECOND


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=64166&edit=1


Thread (7 messages)

« previous php.bugs (#176499) next »