From: slusarz at curecanti dot org
Operating system: Linux
PHP version: 5.2.11
PHP Bug Type: Filter related
Bug description: Invalid parsing in convert.quoted-printable-decode filter
Description:
------------
Using the quoted-printable-decode filter on a stream produces an error.
However, decoding the string using quoted_printable_decode() does not
fail.
The error is thrown whether stream_filter_append() is used or a while
!feof()/fwrite()/fread() loop is used.
Reproduce code:
---------------
$a = fopen('php://temp', 'r+');
fwrite($a, "SERVER: [ID job :3453 Backup rotation] Sauvegarde
r=c3=a9ussi(e)");
rewind($a);
$b = fopen('php://temp', 'r+');
$c = stream_filter_append($b, 'convert.quoted-printable-decode',
STREAM_FILTER_WRITE);
stream_copy_to_stream($a, $b);
rewind($b);
fpassthru($b);
stream_filter_remove($c);
rewind($a);
rewind($b);
fwrite($b, quoted_printable_decode(stream_get_contents($a)));
rewind($b);
fpassthru($b);
Expected result:
----------------
SERVER: [ID job :3453 Backup rotation] Sauvegarde réussi(e)
SERVER: [ID job :3453 Backup rotation] Sauvegarde réussi(e)
Actual result:
--------------
PHP Warning: stream_copy_to_stream(): stream filter
(convert.quoted-printable-decode): invalid byte sequence in /tmp/test.php
on line 8
SERVER: [ID job :3453 Backup rotation] Sauvegarde réussi(e)
--
Edit bug report at http://bugs.php.net/?id=50363&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=50363&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=50363&r=trysnapshot53
Try a snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=50363&r=trysnapshot60
Fixed in SVN:
http://bugs.php.net/fix.php?id=50363&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=50363&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=50363&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=50363&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=50363&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=50363&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=50363&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=50363&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=50363&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=50363&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=50363&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50363&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=50363&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=50363&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=50363&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=50363&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=50363&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=50363&r=mysqlcfg