#27966 [NEW]: double periods with quoted_printable_decode
| From: | br at creativedigitalcolor dot com | Date: | Mon, 12 Apr 2004 20:04:03 +0000 |
| Subject: | #27966 [NEW]: double periods with quoted_printable_decode | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-57959@lists.php.net to get a copy of this message | ||
From: br at creativedigitalcolor dot com
Operating system: redhat 9
PHP version: 4.3.4
PHP Bug Type: Strings related
Bug description: double periods with quoted_printable_decode
Description:
------------
quoted_printable_decode() does not handle lines starting
with "..".
smtp appends a period to the beginning of a new line for
lines already starting with a period. (per rfc2821, this is
to distinguish between the single period used for marking
the end of a message). This is reproducable every time.
I also saw the function make a ".." in the middle of a line
as "." where what was really wanted was "..".
<?php
/* here is my temporary fix, but also further explains the
problem */
/* 1. Replace all of the \n\.\. with \r\. */
$part = preg_replace('/(\n)\.\./is','$1.',$part);
/* 2. Replace all of the .. with =2E. */
$part = preg_replace('/\.\./is','=2E.',$part);
/* 3. Decode print quotable */
$part = quoted_printable_decode($part);
echo $part ;
?>
Reproduce code:
---------------
G=8D=C2r+?yo7*=C0=C0=99=D2=B4HT=D1=E2}=AA=FE[=E0=D2=E0J=B5$o=DA=8F>=9B..=
o=B5d=F6u,=F27=AA6VN=0FM=9F=03=3Dj=3DU=FBl=CF=1A=A1|ok=B3G=AD=B0Y=CF(=D4=
=AC=B4=B0^a=1B&_=D3=AA=3DD=F4s=B8H=AD=D7=97q=E8=08=D4=EBi=14G#=85=83=C5=81=
..=FD~=0E=12i=D4=1A=8C=EA=F5=FD=1C,Q=BB=E87=D3=D6=DE=C9=C2^=DC=D2=0D=F1=DD=
$part = quoted_printable_decode($part);
Expected result:
----------------
<PRE>GÂr+?yo7*ÀÀÒ´HTÑâ}ª[àÒàJµ$oÚ>..oµdöu,ò7ª6VNM=
j=UûlÏ¡|okG°YÏ(Ô¬´°^a&_Óª=
Dôs¸HqèÔëiG#Å.~iÔêõ,Q»è7ÓÖÉÂ^ÜÒ
ñ</PRE>
Actual result:
--------------
<PRE>GÂr+?yo7*ÀÀÒ´HTÑâ}ª[àÒàJµ$oÚ>..oµdöu,ò7ª6VNM=
j=UûlÏ¡|okG°YÏ(Ô¬´°^a&_Óª=
Dôs¸HqèÔëiG#Å..~iÔêõ,Q»è7ÓÖÉÂ^ÜÒ
ñ</PRE>
--
Edit bug report at http://bugs.php.net/?id=27966&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=27966&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=27966&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=27966&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=27966&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=27966&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=27966&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=27966&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=27966&r=support
Expected behavior: http://bugs.php.net/fix.php?id=27966&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=27966&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=27966&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=27966&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27966&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=27966&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=27966&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=27966&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=27966&r=float