ID:               27966
 Updated by:       [EMAIL PROTECTED]
 Reported By:      br at creativedigitalcolor dot com
 Status:           Open
-Bug Type:         Strings related
+Bug Type:         Documentation problem
 Operating System: redhat 9
 PHP Version:      4.3.4
 New Comment:

Reclassified.



Since you're the first and only person complaining about this, we're
not gonna change the behaviour but rather write better documentation
for this/these functions in question..




Previous Comments:
------------------------------------------------------------------------

[2004-04-12 21:06:55] br at creativedigitalcolor dot com

After taking a while to build php with the c-client 

library i found that the imap_qprint produced identical 

results (the extra period was still there). I can not 

deterimine wether or not this is a bug becuase it is a 

question of interpretation.(Are these functions meant to 

run line by line or as one longer string) Either way, 

that pesky period will need removed before the 

attachments can be correctly saved the way they were 

sent.I know from the diff that pine (my email client) 

did remove the extra period when it decoded the 

attachment from the identicat file I parsed with 

php."Quoted printable" needs better defined to be 

included along with the many clearly defined PHP String 

Functions.

------------------------------------------------------------------------

[2004-04-12 20:10:05] [EMAIL PROTECTED]

Aren't you now mixing two different things with each other?

The function quoted_printable_decode() is doing the same as
imap_qprint() which conforms to RFC2045, section 6.7..



------------------------------------------------------------------------

[2004-04-12 18:03:15] br at creativedigitalcolor dot com

quote rfc2821 section 4.5.2:



"   -  Before sending a line of mail text, the SMTP 

client checks the first character of the line.  If it is 

a period, one additional period is inserted at the 

beginning of the line."



<?php



$part = 

"=41=42=43=44..=45=46=47=61=62=63=64=65=66=67=68=30=31=3

2=33=34=35=36=37\n..=41=42=43=44=45=46=47=61=62=63=64=65

=66=67=68=30=31=32=33=34=35=36=37";



$part = quoted_printable_decode($part);



echo "Expected result\n";

echo "ABCD..EFGabcdefgh01234567

.ABCDEFGabcdefgh01234567";



echo "\n\nGot result\n";

echo $part;



echo "\n\n";



?>

------------------------------------------------------------------------

[2004-04-12 17:27:31] [EMAIL PROTECTED]

AFAIK it only doubles the . if it's the ONLY character on a line. Can
you quote from the RFC to prove that's not the case?



Also, please provide a selfcontained example (that we can copy & paste
& run) to show why you think there is a bug.

------------------------------------------------------------------------

[2004-04-12 16:04:03] br at creativedigitalcolor dot com

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 this bug report at http://bugs.php.net/?id=27966&edit=1

Reply via email to