From:             slusarz at curecanti dot org
Operating system: Linux
PHP version:      5.4.11
Package:          Streams related
Bug Type:         Bug
Bug description:quoted-printable-encode stream filter incorrectly discarding 
whitespace

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 bug report at https://bugs.php.net/bug.php?id=64166&edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=64166&r=trysnapshot54
Try a snapshot (PHP 5.3):   
https://bugs.php.net/fix.php?id=64166&r=trysnapshot53
Try a snapshot (trunk):     
https://bugs.php.net/fix.php?id=64166&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=64166&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=64166&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=64166&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=64166&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=64166&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=64166&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=64166&r=notwrong
Not enough info:            
https://bugs.php.net/fix.php?id=64166&r=notenoughinfo
Submitted twice:            
https://bugs.php.net/fix.php?id=64166&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=64166&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64166&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=64166&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=64166&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=64166&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=64166&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=64166&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=64166&r=mysqlcfg

Reply via email to