php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64166 quoted-printable-encode stream filter incorrectly discarding whitespace
Submitted: 2013-02-07 00:49 UTC Modified: 2013-02-25 02:28 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: slusarz at curecanti dot org Assigned:
Status: Closed Package: Streams related
PHP Version: 5.4.11 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: slusarz at curecanti dot org
New email:
PHP Version: OS:

 

 [2013-02-07 00:49 UTC] 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

Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-02-07 01:14 UTC] slusarz at curecanti dot org
This is actually a stream *filter* issue, so put in filter queue.
 [2013-02-07 01:14 UTC] slusarz at curecanti dot org
-Package: Streams related +Package: Filter related
 [2013-02-07 01:14 UTC] slusarz at curecanti dot org
-Package: Filter related +Package: Streams related
 [2013-02-07 01:14 UTC] slusarz at curecanti dot org
Just kidding... apparently there's a difference between "filter" and "stream filter".  Sorry for the noise.
 [2013-02-07 19:41 UTC] slusarz at curecanti dot org
Added pull request with fix that seems to work (w/unit test):

https://github.com/php/php-src/pull/272
 [2013-02-17 09:13 UTC] stas@php.net
The patch seems to have problems with split writes, see my comments there.
 [2013-02-25 02:28 UTC] slusarz at curecanti dot org
Updated pull request with new commit that should take care of all concerns.  Also implemented a more complete unit test.
 [2013-06-16 23:41 UTC] stas@php.net
Automatic comment on behalf of slusarz@curecanti.org
Revision: http://git.php.net/?p=php-src.git;a=commit;h=b5b0a53b09776f74ab4ddf6b9468ab1b41267ab5
Log: Fix #64166: quoted-printable-encode stream filter incorrectly discarding whitespace
 [2013-06-16 23:41 UTC] stas@php.net
-Status: Open +Status: Closed
 [2013-06-16 23:41 UTC] stas@php.net
Automatic comment on behalf of slusarz@curecanti.org
Revision: http://git.php.net/?p=php-src.git;a=commit;h=600d6deef9c8983eb8023171c6c5ae90ca60b6c1
Log: Fix #64166: quoted-printable-encode stream filter incorrectly discarding whitespace
 [2014-10-07 23:18 UTC] stas@php.net
Automatic comment on behalf of slusarz@curecanti.org
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=b5b0a53b09776f74ab4ddf6b9468ab1b41267ab5
Log: Fix #64166: quoted-printable-encode stream filter incorrectly discarding whitespace
 [2014-10-07 23:18 UTC] stas@php.net
Automatic comment on behalf of slusarz@curecanti.org
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=600d6deef9c8983eb8023171c6c5ae90ca60b6c1
Log: Fix #64166: quoted-printable-encode stream filter incorrectly discarding whitespace
 [2014-10-07 23:29 UTC] stas@php.net
Automatic comment on behalf of slusarz@curecanti.org
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=b5b0a53b09776f74ab4ddf6b9468ab1b41267ab5
Log: Fix #64166: quoted-printable-encode stream filter incorrectly discarding whitespace
 [2014-10-07 23:29 UTC] stas@php.net
Automatic comment on behalf of slusarz@curecanti.org
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=600d6deef9c8983eb8023171c6c5ae90ca60b6c1
Log: Fix #64166: quoted-printable-encode stream filter incorrectly discarding whitespace
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 11:01:29 2024 UTC