From: astax dot t at gmail dot com
Operating system: Windows
PHP version: 5.2CVS-2009-05-15 (snap)
PHP Bug Type: ICONV related
Bug description: iconv_mime_encode quoted-printable scheme is broken
Description:
------------
When used with "Q" scheme, iconv_mime_encode produces wrong results,
crashes of hangs. I suspect this happens with long (though not VERY long)
strings.
Lines are not correctly wrapped with "line-break-chars" parameter.
In reproduce code note missing linebreaks in encoded string and duplicated
second word in decoded string.
Reproduce code:
---------------
// Content below is in Windows-1251 charset
$str = 'Ôèëèàë "Çàïàäíî-Ñèáèðñêèé" ÎÀÎ "Ñîáèíáàíê" ðàä ïðåäñòàâèòü';
$par = array(
'scheme' => 'Q',
'input-charset' => 'CP1251',
'output-charset' => 'CP1251',
'line-length' => 74,
);
$res = iconv_mime_encode('Subject', $str, $par);
echo $res."\n";
$res = iconv_mime_decode($res, ICONV_MIME_DECODE_CONTINUE_ON_ERROR,
'CP1251');
echo $res."\n";
=================================================================
Second example:
$str = 'Òåñò òåñò òåñò òåñò òåñò òåñò òåñò òåñò òåñò òåñò òåñò òåñò òåñò
òåñò òåñò';
$par = array(
'scheme' => 'Q',
'input-charset' => 'CP1251',
'output-charset' => 'CP1251',
);
$res = iconv_mime_encode('Subject', $str, $par);
echo $res."\n";
Expected result:
----------------
Subject: =?CP1251?Q?=D4=E8=EB=E8?==?CP1251?Q?=E0=EB=20?==?CP1251?Q?"?=
=?CP1251?Q?=C7=E0=EF=E0=E4=ED=EE-=D1=E8=E1=E8=F0=F1=EA=E8=E9"=20=CE=C0=CE?=
=?CP1251?Q?=20"=D1=EE=E1=E8=ED=E1=E0=ED=EA"=20=F0=E0=E4=20=EF=F0?=
=?CP1251?Q?=E5=E4=F1=F2=E0=E2=E8=F2=FC?=
Subject: Ôèëèàë "Çàïàäíî-Ñèáèðñêèé" ÎÀÎ "Ñîáèíáàíê" ðàä
ïðåäñòàâèòü
=================================================================
Second example:
expected encoded string to be displayed
Actual result:
--------------
Subject:
=?CP1251?Q?=D4=E8=EB=E8?==?CP1251?Q?=E0=EB=20?==?CP1251?Q?"=C7=E0=EF=E0=E4=ED?==?CP1251?Q?"=C7=E0=EF=E0=E4=ED=EE-=D1=E8=E1=E8=F0=F1=EA=E8=E9"=20=CE=C0=CE=20"=D1=EE=E1=E8=ED=E1=E0=ED=EA"=20=F0=E0=E4=20=EF=F0=E5=E4=F1=F2=E0=E2=E8=F2=FC?=
Subject: Ôèëèàë "Çàïàäí"Çàïàäíî-Ñèáèðñêèé" ÎÀÎ "Ñîáèíáàíê" ðàä
ïðåäñòàâèòü
=================================================================
Second example:
PHP hangs
--
Edit bug report at http://bugs.php.net/?id=48289&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=48289&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=48289&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=48289&r=trysnapshot60
Fixed in CVS:
http://bugs.php.net/fix.php?id=48289&r=fixedcvs
Fixed in CVS and need be documented:
http://bugs.php.net/fix.php?id=48289&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=48289&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=48289&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=48289&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=48289&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=48289&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=48289&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=48289&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=48289&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=48289&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48289&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=48289&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=48289&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=48289&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=48289&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=48289&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=48289&r=mysqlcfg