ID: 50363
Updated by: [email protected]
Reported By: slusarz at curecanti dot org
-Status: Open
+Status: Verified
Bug Type: Streams related
-Operating System: Linux
+Operating System: *
-PHP Version: 5.2.11
+PHP Version: 5.*, 6
New Comment:
We have (if I counted right) 3 different implementations for
encoding/decoding quoted-printable. And unfortunately filters.c has the
buggy one which requires the encoded hex chars be upper-case, since this
works:
<?php
$foo = "Sauvegarder=C3=A9ussi(e)";
// $foo = "Sauvegarder=c3=a9ussi(e)"; // Does not work!
$b = fopen('php://temp', 'w+');
stream_filter_append($b, 'convert.quoted-printable-decode',
STREAM_FILTER_WRITE);
fwrite($b, $foo);
rewind($b);
fpassthru($b);
?>
Previous Comments:
------------------------------------------------------------------------
[2009-12-02 20:17:34] slusarz at curecanti dot org
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 this bug report at http://bugs.php.net/?id=50363&edit=1