<?xml version="1.0"?>
<?xml-stylesheet
href="http://www.w3.org/2000/08/w3c-synd/style.css" type="text/css"
?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <channel rdf:about="http://pear.php.net/bugs/search.php">
    <title>PEAR Bug Search Results</title>
    <link>http://pear.php.net/bugs/search.php?cmd=display&amp;package_name%5B0%5D=Mail_mimeDecode</link>
    <description>Search Results</description>
    <dc:language>en-us</dc:language>
    <dc:creator>pear-webmaster@lists.php.net</dc:creator>
    <dc:publisher>pear-webmaster@lists.php.net</dc:publisher>
    <admin:generatorAgent rdf:resource="http://pear.php.net/bugs"/>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
    <items>
     <rdf:Seq>
      <rdf:li rdf:resource="http://pear.php.net/bug/15960" />
      <rdf:li rdf:resource="http://pear.php.net/bug/14634" />
      <rdf:li rdf:resource="http://pear.php.net/bug/13555" />
      <rdf:li rdf:resource="http://pear.php.net/bug/12384" />
      <rdf:li rdf:resource="http://pear.php.net/bug/11539" />
      <rdf:li rdf:resource="http://pear.php.net/bug/11537" />
      <rdf:li rdf:resource="http://pear.php.net/bug/11410" />
      <rdf:li rdf:resource="http://pear.php.net/bug/11263" />
      <rdf:li rdf:resource="http://pear.php.net/bug/9616" />
      <rdf:li rdf:resource="http://pear.php.net/bug/9507" />
      <rdf:li rdf:resource="http://pear.php.net/bug/9100" />
      <rdf:li rdf:resource="http://pear.php.net/bug/7875" />
      <rdf:li rdf:resource="http://pear.php.net/bug/7709" />
      <rdf:li rdf:resource="http://pear.php.net/bug/7676" />
      <rdf:li rdf:resource="http://pear.php.net/bug/7242" />
      <rdf:li rdf:resource="http://pear.php.net/bug/7083" />
      <rdf:li rdf:resource="http://pear.php.net/bug/7065" />
      <rdf:li rdf:resource="http://pear.php.net/bug/6748" />
      <rdf:li rdf:resource="http://pear.php.net/bug/6495" />
      <rdf:li rdf:resource="http://pear.php.net/bug/5730" />
      <rdf:li rdf:resource="http://pear.php.net/bug/4962" />
      <rdf:li rdf:resource="http://pear.php.net/bug/4739" />
      <rdf:li rdf:resource="http://pear.php.net/bug/4585" />
      <rdf:li rdf:resource="http://pear.php.net/bug/2415" />
      <rdf:li rdf:resource="http://pear.php.net/bug/2100" />

     </rdf:Seq>
    </items>
  </channel>

  <image rdf:about="http://pear.php.net/gifs/pearsmall.gif">
    <title>PEAR Bugs</title>
    <url>http://pear.php.net/gifs/pearsmall.gif</url>
    <link>http://pear.php.net/bugs</link>
  </image>

    <item rdf:about="http://pear.php.net/bug/15960">
      <title>Mail_mimeDecode: Bug 15960 [Open] PATCH: mimeDecode ignores character encoding/charset</title>
      <link>http://pear.php.net/bugs/15960</link>
      <content:encoded><![CDATA[<pre>Mail_mimeDecode Bug
Reported by treyhyde
2009-02-28T00:29:48+00:00
PHP: 5.2.8 OS: FreeBSD Package Version: 

Description:
------------
      _decodeHeader ignores the charset portion of base64 encoded headers.  Doing so will work for 8859, ANSI and other 7bit compatible charsets but not for GB* encoded Chinese or other similar &quot;exotic&quot; character sets.

Similarly, it ignores the charset portion of content-type in the mime definition of bodies.

This patch should do the same thing as it did before if iconv is not present and the correct thing if it is present.   You'll want to make sure your iconv.*_encoding php.ini properties are set correctly or set them at run time with iconv_set_encoding

Test script:
---------------
         

Expected result:
----------------
         

Actual result:
--------------</pre>]]></content:encoded>
      <description><![CDATA[<pre>Mail_mimeDecode Bug
Reported by treyhyde
2009-02-28T00:29:48+00:00
PHP: 5.2.8 OS: FreeBSD Package Version: 

Description:
------------
      _decodeHeader ignores the charset portion of base64 encoded headers.  Doing so will work for 8859, ANSI and other 7bit compatible charsets but not for GB* encoded Chinese or other similar &quot;exotic&quot; character sets.

Similarly, it ignores the charset portion of content-type in the mime definition of bodies.

This patch should do the same thing as it did before if iconv is not present and the correct thing if it is present.   You'll want to make sure your iconv.*_encoding php.ini properties are set correctly or set them at run time with iconv_set_encoding

Test script:
---------------
         

Expected result:
----------------
         

Actual result:
--------------</pre>]]></description>
      <dc:date>2009-08-26T06:41:33+00:00</dc:date>
      <dc:creator>rhyde &amp;#x61;&amp;#116; hydenetworks &amp;#x64;&amp;#111;&amp;#x74; com</dc:creator>
      <dc:subject>Mail_mimeDecode Bug</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/14634">
      <title>Mail_mimeDecode: Feature/Change Request 14634 [Open] UTF-8 charset header &amp; body decode</title>
      <link>http://pear.php.net/bugs/14634</link>
      <content:encoded><![CDATA[<pre>Mail_mimeDecode Feature/Change Request
Reported by clst
2008-09-10T05:44:19+00:00
PHP: Irrelevant OS:  Package Version: 1.5.0

Description:
------------
Duplicate of the other UTF-8 header bug. Sorry, but I have a patch :)

If the body of an E-Mail is using charset UTF-8 (no matter what encoding (8-bit, quoted-printable, etc.) it uses) it is returned as is.
All other E-Mail content usually is not multibyte so I think it would be better to return the decoded body.

Test script:
---------------
Sample1:
Subject: =?Windows-1252?Q?Re:_=5B#320072=5D_t=F6st?=
Content-Type: text/plain;
	charset=&quot;Windows-1252&quot;
Content-Transfer-Encoding: quoted-printable
body:
t=E4=E4 t=E4=E4,

Sample2:
Subject: =?UTF-8?Q?Re:_=5B#320072=5D_t=C3=B6st?=
Content-Type: text/plain;
	format=flowed;
	charset=&quot;UTF-8&quot;;
	reply-type=original
Content-Transfer-Encoding: 8bit
body:
tÃ&amp;#164;Ã&amp;#164; tÃ&amp;#164;Ã&amp;#164;,
&lt;encoding could be munged by web form&gt;

Expected result:
----------------
Sample1 = Sample2


Actual result:
--------------
Sample1:
Subject: Re: [#320072] tÃ¶st
body: tÃ¤Ã¤ tÃ¤Ã¤,
Sample2:
Subject: Re: [#320072] tÃÂ¶st
body: tÃ&amp;#164;Ã&amp;#164; tÃ&amp;#164;Ã&amp;#164;,

&lt;encoding could be munged by web form&gt;</pre>]]></content:encoded>
      <description><![CDATA[<pre>Mail_mimeDecode Feature/Change Request
Reported by clst
2008-09-10T05:44:19+00:00
PHP: Irrelevant OS:  Package Version: 1.5.0

Description:
------------
Duplicate of the other UTF-8 header bug. Sorry, but I have a patch :)

If the body of an E-Mail is using charset UTF-8 (no matter what encoding (8-bit, quoted-printable, etc.) it uses) it is returned as is.
All other E-Mail content usually is not multibyte so I think it would be better to return the decoded body.

Test script:
---------------
Sample1:
Subject: =?Windows-1252?Q?Re:_=5B#320072=5D_t=F6st?=
Content-Type: text/plain;
	charset=&quot;Windows-1252&quot;
Content-Transfer-Encoding: quoted-printable
body:
t=E4=E4 t=E4=E4,

Sample2:
Subject: =?UTF-8?Q?Re:_=5B#320072=5D_t=C3=B6st?=
Content-Type: text/plain;
	format=flowed;
	charset=&quot;UTF-8&quot;;
	reply-type=original
Content-Transfer-Encoding: 8bit
body:
tÃ&amp;#164;Ã&amp;#164; tÃ&amp;#164;Ã&amp;#164;,
&lt;encoding could be munged by web form&gt;

Expected result:
----------------
Sample1 = Sample2


Actual result:
--------------
Sample1:
Subject: Re: [#320072] tÃ¶st
body: tÃ¤Ã¤ tÃ¤Ã¤,
Sample2:
Subject: Re: [#320072] tÃÂ¶st
body: tÃ&amp;#164;Ã&amp;#164; tÃ&amp;#164;Ã&amp;#164;,

&lt;encoding could be munged by web form&gt;</pre>]]></description>
      <dc:date>2008-12-27T01:31:05+00:00</dc:date>
      <dc:creator>cs+php &amp;#x61;&amp;#116; apl &amp;#x64;&amp;#111;&amp;#x74; li</dc:creator>
      <dc:subject>Mail_mimeDecode Feature/Change Request</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/13555">
      <title>Mail_mimeDecode: Bug 13555 [Open] Header-Decode: Removing white-space incomplete</title>
      <link>http://pear.php.net/bugs/13555</link>
      <content:encoded><![CDATA[<pre>Mail_mimeDecode Bug
Reported by brody
2008-04-01T08:14:49+00:00
PHP: 5.2.2 OS: Windows Package Version: 

Description:
------------
Line below comment &quot;// Remove white space between encoded-words &quot; of file &quot;mimeDecode.php&quot; does only work correctly, if the encoded line does only contains ONE space (and thus TWO encoded words); e.g. subjects (as in my case, which are splitted into more words because of its original length) a decoded wrongly having additional spaces. This behaviouer leaded in my case to a later search with this subject to get no result.

I guess, that either the regex must be changed to remove all spaces (I'm not fit enough in regex to do so) or to implement a loop for removing them.

Test script:
---------------
&lt;?php
require_once( 'Mail/mimeDecode.php' );

$encodedsubject = &quot;=?utf-8?B?W0pJUkFdIEtvbW1lbnRpZXJ0OiAoSUNULTQ1MTEpIFI=?= =?utf-8?B?ZXN1bHRTZXQgaXMgY2xvc2VkIGFtIEVuZGUgZGVyIFI=?= =?utf-8?B?ZWdlbGF1c2bDvGhydW5nIG1pdCBEQkMgKCMgMjIxKQ==?=&quot;;
echo &quot;decoding &quot; . $encodedsubject;
$decoder = new Mail_mimeDecode(&quot;nothing&quot;);
$decodedsubject = $decoder-&gt;_decodeHeader($encodedsubject);

echo  &quot;\nResult:&quot; . $decodedsubject;
echo &quot;\n\nline contains an errornous space between 'R' and 'egelaus...' (the continuation of the word)&quot;;


?&gt;

Expected result:
----------------
its showing an additional space, where its wrong.</pre>]]></content:encoded>
      <description><![CDATA[<pre>Mail_mimeDecode Bug
Reported by brody
2008-04-01T08:14:49+00:00
PHP: 5.2.2 OS: Windows Package Version: 

Description:
------------
Line below comment &quot;// Remove white space between encoded-words &quot; of file &quot;mimeDecode.php&quot; does only work correctly, if the encoded line does only contains ONE space (and thus TWO encoded words); e.g. subjects (as in my case, which are splitted into more words because of its original length) a decoded wrongly having additional spaces. This behaviouer leaded in my case to a later search with this subject to get no result.

I guess, that either the regex must be changed to remove all spaces (I'm not fit enough in regex to do so) or to implement a loop for removing them.

Test script:
---------------
&lt;?php
require_once( 'Mail/mimeDecode.php' );

$encodedsubject = &quot;=?utf-8?B?W0pJUkFdIEtvbW1lbnRpZXJ0OiAoSUNULTQ1MTEpIFI=?= =?utf-8?B?ZXN1bHRTZXQgaXMgY2xvc2VkIGFtIEVuZGUgZGVyIFI=?= =?utf-8?B?ZWdlbGF1c2bDvGhydW5nIG1pdCBEQkMgKCMgMjIxKQ==?=&quot;;
echo &quot;decoding &quot; . $encodedsubject;
$decoder = new Mail_mimeDecode(&quot;nothing&quot;);
$decodedsubject = $decoder-&gt;_decodeHeader($encodedsubject);

echo  &quot;\nResult:&quot; . $decodedsubject;
echo &quot;\n\nline contains an errornous space between 'R' and 'egelaus...' (the continuation of the word)&quot;;


?&gt;

Expected result:
----------------
its showing an additional space, where its wrong.</pre>]]></description>
      <dc:date>2008-12-27T14:11:32+00:00</dc:date>
      <dc:creator>wolfgang &amp;#x64;&amp;#111;&amp;#x74; brodowski &amp;#x61;&amp;#116; innovations &amp;#x64;&amp;#111;&amp;#x74; de</dc:creator>
      <dc:subject>Mail_mimeDecode Bug</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/12384">
      <title>Mail_mimeDecode: Bug 12384 [Open] dropping last MIME part - have solution</title>
      <link>http://pear.php.net/bugs/12384</link>
      <content:encoded><![CDATA[<pre>Mail_mimeDecode Bug
Reported by vermette
2007-11-05T00:54:03+00:00
PHP: 4.4.1 OS: Linux Package Version: 1.5.0

Description:
------------
There is a tiny bug in line 506 of mimeDecode.php, where

&quot;for ($i = 1; $i &lt; count($tmp) - 1; $i++) {&quot;

drops the last body part because the of the &quot;&lt;&quot; paired with the &quot;-1&quot;.

I noticed this in decoding a multipart-report message, it was dropping the RFC822 message attached as the last part.  I also see that someone reported that this package doesn't decode forwarded messages -- if that relates to attached forwards then this may fix that as well.

The fix of course is to change line 506 to

&quot;for ($i = 1; $i &lt; count($tmp); $i++) {&quot;

Sorry, not high tech with CVS at the moment, no patch.

cheers,
j.

Test script:
---------------
n/a

Expected result:
----------------
n/a

Actual result:
--------------
n/a</pre>]]></content:encoded>
      <description><![CDATA[<pre>Mail_mimeDecode Bug
Reported by vermette
2007-11-05T00:54:03+00:00
PHP: 4.4.1 OS: Linux Package Version: 1.5.0

Description:
------------
There is a tiny bug in line 506 of mimeDecode.php, where

&quot;for ($i = 1; $i &lt; count($tmp) - 1; $i++) {&quot;

drops the last body part because the of the &quot;&lt;&quot; paired with the &quot;-1&quot;.

I noticed this in decoding a multipart-report message, it was dropping the RFC822 message attached as the last part.  I also see that someone reported that this package doesn't decode forwarded messages -- if that relates to attached forwards then this may fix that as well.

The fix of course is to change line 506 to

&quot;for ($i = 1; $i &lt; count($tmp); $i++) {&quot;

Sorry, not high tech with CVS at the moment, no patch.

cheers,
j.

Test script:
---------------
n/a

Expected result:
----------------
n/a

Actual result:
--------------
n/a</pre>]]></description>
      <dc:date>2007-11-05T00:54:03+00:00</dc:date>
      <dc:creator>josh &amp;#x61;&amp;#116; calydonian &amp;#x64;&amp;#111;&amp;#x74; com</dc:creator>
      <dc:subject>Mail_mimeDecode Bug</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/11539">
      <title>Mail_mimeDecode: Feature/Change Request 11539 [Open] Full Support of RFC2231 for attach-filename</title>
      <link>http://pear.php.net/bugs/11539</link>
      <content:encoded><![CDATA[<pre>Mail_mimeDecode Feature/Change Request
Reported by itam
2007-07-06T00:52:21+00:00
PHP: Irrelevant OS: Linux/Windows Package Version: 1.5.0

Description:
------------
Like previous bug report #9616, some attached filename,
that is made by the scheme of RFC2231, couldn't be extracted.

So, when you decode filename of test script sample, 
you get nothing else.

I make patch for this problem. 
I hope this patch helps to you.

NOTICE:
The patch assume that my previous patch of #11537
was already applied. 


Test script:
---------------
$aMailContents   = array();
$aMailContents[] = 'Content-Type: application/octet-stream;';
$aMailContents[] = ' name*0*=iso-2022-jp\'\'%1B%24B%40%3DIJ%1B%28BABC%1B%24B%25%22%25s%251%21%3C%1B%28B;';
$aMailContents[] = ' name*1*=%1B%24B%25H%1B%28B%2Etxt';
$aMailContents[] = 'Content-Disposition: attachment;';
$aMailContents[] = ' filename*0*=iso-2022-jp\'\'%1B%24B%40%3DIJ%1B%28BABC%1B%24B%25%22%25s%251%21%3C%1B%28B;';
$aMailContents[] = ' filename*1*=%1B%24B%25H%1B%28B%2Etxt';
$aMailContents[] = '';
$aMailContents[] = 'g0GDk4NQgVuDZw0K';

$aParams = array();
$aParams['decode_headers'] = TRUE;
$aParams['include_bodies'] = TRUE;
$aParams['decode_bodies']  = TRUE;
$aParams['input']          = join(&quot;\r\n&quot;, $aMailContents);

$oMailStructure = Mail_mimeDecode::decode($aParams);
print_r($oMailStructure);


Expected result:
----------------
stdClass Object
(
    [headers] =&gt; Array
        (
            [content-type] =&gt; application/octet-stream; name*0*=iso-2022-jp''%1B%24B%40%3DIJ%1B%28BABC%1B%24B%25%22%25s%251%21%3C%1B%28B; name*1*=%1B%24B%25H%1B%28B%2Etxt
            [content-disposition] =&gt; attachment; filename*0*=iso-2022-jp''%1B%24B%40%3DIJ%1B%28BABC%1B%24B%25%22%25s%251%21%3C%1B%28B; filename*1*=%1B%24B%25H%1B%28B%2Etxt
        )

    [ctype_primary] =&gt; application
    [ctype_secondary] =&gt; octet-stream
    [ctype_parameters] =&gt; Array
        (
            [name] =&gt; ÂÂ»â¢iABCÆAÆâÆPÂ[Æg.txt
        )

    [disposition] =&gt; attachment
    [d_parameters] =&gt; Array
        (
            [filename] =&gt; ÂÂ»â¢iABCÆAÆâÆPÂ[Æg.txt
        )

    [body] =&gt; g0GDk4NQgVuDZw0K
)


Actual result:
--------------
stdClass Object
(
    [headers] =&gt; Array
        (
            [content-type] =&gt; application/octet-stream; name*0*=iso-2022-jp''%1B%24B%40%3DIJ%1B%28BABC%1B%24B%25%22%25s%251%21%3C%1B%28B; name*1*=%1B%24B%25H%1B%28B%2Etxt
            [content-disposition] =&gt; attachment; filename*0*=iso-2022-jp''%1B%24B%40%3DIJ%1B%28BABC%1B%24B%25%22%25s%251%21%3C%1B%28B; filename*1*=%1B%24B%25H%1B%28B%2Etxt
        )

    [ctype_primary] =&gt; application
    [ctype_secondary] =&gt; octet-stream
    [ctype_parameters] =&gt; Array
        (
            [name*0*] =&gt; iso-2022-jp''%1B%24B%40%3DIJ%1B%28BABC%1B%24B%25%22%25s%251%21%3C%1B%28B
            [name*1*] =&gt; %1B%24B%25H%1B%28B%2Etxt
        )

    [disposition] =&gt; attachment
    [d_parameters] =&gt; Array
        (
            [filename*0*] =&gt; iso-2022-jp''%1B%24B%40%3DIJ%1B%28BABC%1B%24B%25%22%25s%251%21%3C%1B%28B
            [filename*1*] =&gt; %1B%24B%25H%1B%28B%2Etxt
        )

    [body] =&gt; g0GDk4NQgVuDZw0K
)</pre>]]></content:encoded>
      <description><![CDATA[<pre>Mail_mimeDecode Feature/Change Request
Reported by itam
2007-07-06T00:52:21+00:00
PHP: Irrelevant OS: Linux/Windows Package Version: 1.5.0

Description:
------------
Like previous bug report #9616, some attached filename,
that is made by the scheme of RFC2231, couldn't be extracted.

So, when you decode filename of test script sample, 
you get nothing else.

I make patch for this problem. 
I hope this patch helps to you.

NOTICE:
The patch assume that my previous patch of #11537
was already applied. 


Test script:
---------------
$aMailContents   = array();
$aMailContents[] = 'Content-Type: application/octet-stream;';
$aMailContents[] = ' name*0*=iso-2022-jp\'\'%1B%24B%40%3DIJ%1B%28BABC%1B%24B%25%22%25s%251%21%3C%1B%28B;';
$aMailContents[] = ' name*1*=%1B%24B%25H%1B%28B%2Etxt';
$aMailContents[] = 'Content-Disposition: attachment;';
$aMailContents[] = ' filename*0*=iso-2022-jp\'\'%1B%24B%40%3DIJ%1B%28BABC%1B%24B%25%22%25s%251%21%3C%1B%28B;';
$aMailContents[] = ' filename*1*=%1B%24B%25H%1B%28B%2Etxt';
$aMailContents[] = '';
$aMailContents[] = 'g0GDk4NQgVuDZw0K';

$aParams = array();
$aParams['decode_headers'] = TRUE;
$aParams['include_bodies'] = TRUE;
$aParams['decode_bodies']  = TRUE;
$aParams['input']          = join(&quot;\r\n&quot;, $aMailContents);

$oMailStructure = Mail_mimeDecode::decode($aParams);
print_r($oMailStructure);


Expected result:
----------------
stdClass Object
(
    [headers] =&gt; Array
        (
            [content-type] =&gt; application/octet-stream; name*0*=iso-2022-jp''%1B%24B%40%3DIJ%1B%28BABC%1B%24B%25%22%25s%251%21%3C%1B%28B; name*1*=%1B%24B%25H%1B%28B%2Etxt
            [content-disposition] =&gt; attachment; filename*0*=iso-2022-jp''%1B%24B%40%3DIJ%1B%28BABC%1B%24B%25%22%25s%251%21%3C%1B%28B; filename*1*=%1B%24B%25H%1B%28B%2Etxt
        )

    [ctype_primary] =&gt; application
    [ctype_secondary] =&gt; octet-stream
    [ctype_parameters] =&gt; Array
        (
            [name] =&gt; ÂÂ»â¢iABCÆAÆâÆPÂ[Æg.txt
        )

    [disposition] =&gt; attachment
    [d_parameters] =&gt; Array
        (
            [filename] =&gt; ÂÂ»â¢iABCÆAÆâÆPÂ[Æg.txt
        )

    [body] =&gt; g0GDk4NQgVuDZw0K
)


Actual result:
--------------
stdClass Object
(
    [headers] =&gt; Array
        (
            [content-type] =&gt; application/octet-stream; name*0*=iso-2022-jp''%1B%24B%40%3DIJ%1B%28BABC%1B%24B%25%22%25s%251%21%3C%1B%28B; name*1*=%1B%24B%25H%1B%28B%2Etxt
            [content-disposition] =&gt; attachment; filename*0*=iso-2022-jp''%1B%24B%40%3DIJ%1B%28BABC%1B%24B%25%22%25s%251%21%3C%1B%28B; filename*1*=%1B%24B%25H%1B%28B%2Etxt
        )

    [ctype_primary] =&gt; application
    [ctype_secondary] =&gt; octet-stream
    [ctype_parameters] =&gt; Array
        (
            [name*0*] =&gt; iso-2022-jp''%1B%24B%40%3DIJ%1B%28BABC%1B%24B%25%22%25s%251%21%3C%1B%28B
            [name*1*] =&gt; %1B%24B%25H%1B%28B%2Etxt
        )

    [disposition] =&gt; attachment
    [d_parameters] =&gt; Array
        (
            [filename*0*] =&gt; iso-2022-jp''%1B%24B%40%3DIJ%1B%28BABC%1B%24B%25%22%25s%251%21%3C%1B%28B
            [filename*1*] =&gt; %1B%24B%25H%1B%28B%2Etxt
        )

    [body] =&gt; g0GDk4NQgVuDZw0K
)</pre>]]></description>
      <dc:date>2007-07-06T00:52:21+00:00</dc:date>
      <dc:creator>itam &amp;#x61;&amp;#116; itam &amp;#x64;&amp;#111;&amp;#x74; jp</dc:creator>
      <dc:subject>Mail_mimeDecode Feature/Change Request</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/11537">
      <title>Mail_mimeDecode: Bug 11537 [Open] Parse failure for filename includes DQuote</title>
      <link>http://pear.php.net/bugs/11537</link>
      <content:encoded><![CDATA[<pre>Mail_mimeDecode Bug
Reported by itam
2007-07-06T00:15:36+00:00
PHP: Irrelevant OS: Linux/Windows Package Version: 1.5.0

Description:
------------
Like previous bug report #11263, some attached filename,
that includes double-quote char, couldn't be extracted.

So, when you decode filename of test script sample by
base64, you get Japanese JIS code string includes
double-quote char.
If decode_headers parameter was false, it works well.

I analyzed mimeDecode.php and make patch for this
problem. I hope this patch helps to you.


Test script:
---------------
$aMailContents   = array();
$aMailContents[] = 'Content-Type: application/octet-stream;';
$aMailContents[] = ' name=&quot;=?ISO-2022-JP?B?GyRCQD1JShsoQkFCQxskQiUiJXMlMSE8JUgbKEI=?=';
$aMailContents[] = ' =?ISO-2022-JP?B?LnR4dA==?=&quot;';
$aMailContents[] = 'Content-Disposition: attachment;';
$aMailContents[] = ' filename=&quot;=?ISO-2022-JP?B?GyRCQD1JShsoQkFCQxskQiUiJXMlMSE8JUgbKEI=?=';
$aMailContents[] = ' =?ISO-2022-JP?B?LnR4dA==?=&quot;';
$aMailContents[] = '';
$aMailContents[] = 'g0GDk4NQgVuDZw0K';

$aParams = array();
$aParams['decode_headers'] = TRUE;
$aParams['include_bodies'] = TRUE;
$aParams['decode_bodies']  = TRUE;
$aParams['input']          = join(&quot;\r\n&quot;, $aMailContents);

$oMailStructure = Mail_mimeDecode::decode($aParams);
print_r($oMailStructure);


Expected result:
----------------
stdClass Object
(
    [headers] =&gt; Array
        (
            [content-type] =&gt; application/octet-stream; name=&quot;ÂÂ»â¢iABCÆAÆâÆPÂ[Æg.txt&quot;
            [content-disposition] =&gt; attachment; filename=&quot;ÂÂ»â¢iABCÆAÆâÆPÂ[Æg.txt&quot;
        )

    [ctype_primary] =&gt; application
    [ctype_secondary] =&gt; octet-stream
    [ctype_parameters] =&gt; Array
        (
            [name] =&gt; ÂÂ»â¢iABCÆAÆâÆPÂ[Æg.txt
        )

    [disposition] =&gt; attachment
    [d_parameters] =&gt; Array
        (
            [filename] =&gt; ÂÂ»â¢iABCÆAÆâÆPÂ[Æg.txt
        )

    [body] =&gt; g0GDk4NQgVuDZw0K
)


Actual result:
--------------
stdClass Object
(
    [headers] =&gt; Array
        (
            [content-type] =&gt; application/octet-stream; name=&quot;ÂÂ»â¢iABCÆAÆâÆPÂ[Æg.txt&quot;
            [content-disposition] =&gt; attachment; filename=&quot;ÂÂ»â¢iABCÆAÆâÆPÂ[Æg.txt&quot;
        )

    [ctype_primary] =&gt; application
    [ctype_secondary] =&gt; octet-stream
    [disposition] =&gt; attachment
    [body] =&gt; g0GDk4NQgVuDZw0K
)</pre>]]></content:encoded>
      <description><![CDATA[<pre>Mail_mimeDecode Bug
Reported by itam
2007-07-06T00:15:36+00:00
PHP: Irrelevant OS: Linux/Windows Package Version: 1.5.0

Description:
------------
Like previous bug report #11263, some attached filename,
that includes double-quote char, couldn't be extracted.

So, when you decode filename of test script sample by
base64, you get Japanese JIS code string includes
double-quote char.
If decode_headers parameter was false, it works well.

I analyzed mimeDecode.php and make patch for this
problem. I hope this patch helps to you.


Test script:
---------------
$aMailContents   = array();
$aMailContents[] = 'Content-Type: application/octet-stream;';
$aMailContents[] = ' name=&quot;=?ISO-2022-JP?B?GyRCQD1JShsoQkFCQxskQiUiJXMlMSE8JUgbKEI=?=';
$aMailContents[] = ' =?ISO-2022-JP?B?LnR4dA==?=&quot;';
$aMailContents[] = 'Content-Disposition: attachment;';
$aMailContents[] = ' filename=&quot;=?ISO-2022-JP?B?GyRCQD1JShsoQkFCQxskQiUiJXMlMSE8JUgbKEI=?=';
$aMailContents[] = ' =?ISO-2022-JP?B?LnR4dA==?=&quot;';
$aMailContents[] = '';
$aMailContents[] = 'g0GDk4NQgVuDZw0K';

$aParams = array();
$aParams['decode_headers'] = TRUE;
$aParams['include_bodies'] = TRUE;
$aParams['decode_bodies']  = TRUE;
$aParams['input']          = join(&quot;\r\n&quot;, $aMailContents);

$oMailStructure = Mail_mimeDecode::decode($aParams);
print_r($oMailStructure);


Expected result:
----------------
stdClass Object
(
    [headers] =&gt; Array
        (
            [content-type] =&gt; application/octet-stream; name=&quot;ÂÂ»â¢iABCÆAÆâÆPÂ[Æg.txt&quot;
            [content-disposition] =&gt; attachment; filename=&quot;ÂÂ»â¢iABCÆAÆâÆPÂ[Æg.txt&quot;
        )

    [ctype_primary] =&gt; application
    [ctype_secondary] =&gt; octet-stream
    [ctype_parameters] =&gt; Array
        (
            [name] =&gt; ÂÂ»â¢iABCÆAÆâÆPÂ[Æg.txt
        )

    [disposition] =&gt; attachment
    [d_parameters] =&gt; Array
        (
            [filename] =&gt; ÂÂ»â¢iABCÆAÆâÆPÂ[Æg.txt
        )

    [body] =&gt; g0GDk4NQgVuDZw0K
)


Actual result:
--------------
stdClass Object
(
    [headers] =&gt; Array
        (
            [content-type] =&gt; application/octet-stream; name=&quot;ÂÂ»â¢iABCÆAÆâÆPÂ[Æg.txt&quot;
            [content-disposition] =&gt; attachment; filename=&quot;ÂÂ»â¢iABCÆAÆâÆPÂ[Æg.txt&quot;
        )

    [ctype_primary] =&gt; application
    [ctype_secondary] =&gt; octet-stream
    [disposition] =&gt; attachment
    [body] =&gt; g0GDk4NQgVuDZw0K
)</pre>]]></description>
      <dc:date>2007-07-06T00:15:36+00:00</dc:date>
      <dc:creator>itam &amp;#x61;&amp;#116; itam &amp;#x64;&amp;#111;&amp;#x74; jp</dc:creator>
      <dc:subject>Mail_mimeDecode Bug</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/11410">
      <title>Mail_mimeDecode: Feature/Change Request 11410 [Open] MMS handling</title>
      <link>http://pear.php.net/bugs/11410</link>
      <content:encoded><![CDATA[<pre>Mail_mimeDecode Feature/Change Request
Reported by aproka
2007-06-22T18:48:48+00:00
PHP: 5.2.0 OS:  Package Version: 1.5.0

Description:
------------
To handle MMS messages &quot;case 'application/vnd.wap.multipart.related':&quot; have to be added to Mail/mimeDecode.php line #293</pre>]]></content:encoded>
      <description><![CDATA[<pre>Mail_mimeDecode Feature/Change Request
Reported by aproka
2007-06-22T18:48:48+00:00
PHP: 5.2.0 OS:  Package Version: 1.5.0

Description:
------------
To handle MMS messages &quot;case 'application/vnd.wap.multipart.related':&quot; have to be added to Mail/mimeDecode.php line #293</pre>]]></description>
      <dc:date>2007-06-22T18:48:48+00:00</dc:date>
      <dc:creator>aron &amp;#x64;&amp;#111;&amp;#x74; mezei &amp;#x61;&amp;#116; nws &amp;#x64;&amp;#111;&amp;#x74; hu</dc:creator>
      <dc:subject>Mail_mimeDecode Feature/Change Request</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/11263">
      <title>Mail_mimeDecode: Bug 11263 [Assigned] content disposition filename bug with apostophe</title>
      <link>http://pear.php.net/bugs/11263</link>
      <content:encoded><![CDATA[<pre>Mail_mimeDecode Bug
Reported by xnote
2007-06-10T03:24:38+00:00
PHP: 5.2.1 OS: Fedora 7 Package Version: 

Description:
------------
I have found that the function _parseHeaderValue skips any filename with an apostrophe in it.

For example, If I were to send a file/attachment with the filename=&quot;Ain't it beautiful&quot; it would skip due to the ' in Ain't.

I did a str_replace on $input after strlen($input) and omitted the ' and it works correctly.

I don't know if it's the regex incorrectly parsing due to my novice knowledge of regular expressions.

Test script:
---------------
        if (($pos = strpos($input, ';')) !== false) {

            $return['value'] = trim(substr($input, 0, $pos));
            $input = trim(substr($input, $pos+1));

            if (strlen($input) &gt; 0) {
$input = str_replace(&quot;'&quot;,&quot;&quot;,$input);
                // This splits on a semi-colon, if there's no preceeding backslash
                // Now works with quoted values; had to glue the \; breaks in PHP
                // the regex is already bordering on incomprehensible
                $splitRegex = '/([^;\'&quot;]*[\'&quot;]([^\'&quot;]*([^\'&quot;]*)*)[\'&quot;][^;\'&quot;]*|([^;]+))(;|$)/';
                preg_match_all($splitRegex, $input, $matches);
                $parameters = array();
                for ($i=0; $i&lt;count($matches[0]); $i++) {
                    $param = $matches[0][$i];
                    while (substr($param, -2) == '\;') {
                        $param .= $matches[0][++$i];
                    }
                    $parameters[] = $param;
                }

Expected result:
----------------
n/a  no need to expound due to it's simplicity of explaining it beforehand.

Actual result:
--------------
n/a  no need to expound due to it's simplicity of explaining it beforehand.</pre>]]></content:encoded>
      <description><![CDATA[<pre>Mail_mimeDecode Bug
Reported by xnote
2007-06-10T03:24:38+00:00
PHP: 5.2.1 OS: Fedora 7 Package Version: 

Description:
------------
I have found that the function _parseHeaderValue skips any filename with an apostrophe in it.

For example, If I were to send a file/attachment with the filename=&quot;Ain't it beautiful&quot; it would skip due to the ' in Ain't.

I did a str_replace on $input after strlen($input) and omitted the ' and it works correctly.

I don't know if it's the regex incorrectly parsing due to my novice knowledge of regular expressions.

Test script:
---------------
        if (($pos = strpos($input, ';')) !== false) {

            $return['value'] = trim(substr($input, 0, $pos));
            $input = trim(substr($input, $pos+1));

            if (strlen($input) &gt; 0) {
$input = str_replace(&quot;'&quot;,&quot;&quot;,$input);
                // This splits on a semi-colon, if there's no preceeding backslash
                // Now works with quoted values; had to glue the \; breaks in PHP
                // the regex is already bordering on incomprehensible
                $splitRegex = '/([^;\'&quot;]*[\'&quot;]([^\'&quot;]*([^\'&quot;]*)*)[\'&quot;][^;\'&quot;]*|([^;]+))(;|$)/';
                preg_match_all($splitRegex, $input, $matches);
                $parameters = array();
                for ($i=0; $i&lt;count($matches[0]); $i++) {
                    $param = $matches[0][$i];
                    while (substr($param, -2) == '\;') {
                        $param .= $matches[0][++$i];
                    }
                    $parameters[] = $param;
                }

Expected result:
----------------
n/a  no need to expound due to it's simplicity of explaining it beforehand.

Actual result:
--------------
n/a  no need to expound due to it's simplicity of explaining it beforehand.</pre>]]></description>
      <dc:date>2007-06-10T16:30:53+00:00</dc:date>
      <dc:creator>alan &amp;#x61;&amp;#116; xnote &amp;#x64;&amp;#111;&amp;#x74; com</dc:creator>
      <dc:subject>Mail_mimeDecode Bug</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/9616">
      <title>Mail_mimeDecode: Bug 9616 [Analyzed] Failure to parse [file]name*0=x; [file]name*1=x</title>
      <link>http://pear.php.net/bugs/9616</link>
      <content:encoded><![CDATA[<pre>Mail_mimeDecode Bug
Reported by l0c4lh0st.nl@...
2006-12-14T12:54:50+00:00
PHP: 5.1.2 OS: Windows Package Version: 

Description:
------------
When parsing the headers, it fails to recognize the filename*0=x; filename*1=blah; filename*2=blah; (I assume this is used because of long filenames, the filename I had was pretty long).

Anyway, you get the seperate parts (the means, filename*0, filename*1 etc. etc.).

With the fix below you get the full filename.

Test script:
---------------
&lt;?php
                /* (It's kinda nasty, but does the trick.) */

                // This splits on a semi-colon, if there's no preceeding backslash
                // Now works with quoted values; had to glue the \; breaks in PHP
                // the regex is already bordering on incomprehensible
                
                $splitRegex = '/([^;\'&quot;]*[\'&quot;]([^\'&quot;]*([^\'&quot;]*)*)[\'&quot;][^;\'&quot;]*|([^;]+))(;|$)/';
                preg_match_all($splitRegex, $input, $matches);
                
                /* Start fix. */
                if (preg_match('/^([^\*]+)\*0\=/is', $matches[0][0], $aMatches))
                {
	                $matches[0] = array($aMatches[1] . '=' . implode('', $matches[2]));
                }
                /* End fix. */
?&gt;

Expected result:
----------------
stdClass Object
(
    [headers] =&gt; Array
        (
            [content-type] =&gt; image/jpeg; name*0=&quot;verylongfilenamegoeshereblabla.jpg&quot;
            [content-transfer-encoding] =&gt; base64
            [content-id] =&gt; &lt;xxxxxxxxxxx@gmail.com&gt;
            [content-disposition] =&gt; inline; filename*0=&quot;verylongfilenamegoeshereblabla&quot;; filename*1=&quot;.jpg&quot;
        )

    [ctype_primary] =&gt; image
    [ctype_secondary] =&gt; jpeg
    [ctype_parameters] =&gt; Array
        (
            [name] =&gt; verylongfilenamegoeshereblabla.jpg
        )

    [disposition] =&gt; inline
    [d_parameters] =&gt; Array
        (
            [filename] =&gt; verylongfilenamegoeshereblabla.jpg
        )

)

Actual result:
--------------
stdClass Object
(
    [headers] =&gt; Array
        (
            [content-type] =&gt; image/jpeg; name*0=&quot;verylongfilenamegoeshereblabla.jpg&quot;
            [content-transfer-encoding] =&gt; base64
            [content-id] =&gt; &lt;xxxxxxxxxxx@gmail.com&gt;
            [content-disposition] =&gt; inline; filename*0=&quot;verylongfilenamegoeshereblabla&quot;; filename*1=&quot;.jpg&quot;
        )

    [ctype_primary] =&gt; image
    [ctype_secondary] =&gt; jpeg
    [ctype_parameters] =&gt; Array
        (
            [name*0] =&gt; verylongfilenamegoeshereblabla.jpg
        )

    [disposition] =&gt; inline
    [d_parameters] =&gt; Array
        (
            [filename*0] =&gt; verylongfilenamegoeshereblabla
            [filename*1] =&gt; .jpg
        )

)</pre>]]></content:encoded>
      <description><![CDATA[<pre>Mail_mimeDecode Bug
Reported by l0c4lh0st.nl@...
2006-12-14T12:54:50+00:00
PHP: 5.1.2 OS: Windows Package Version: 

Description:
------------
When parsing the headers, it fails to recognize the filename*0=x; filename*1=blah; filename*2=blah; (I assume this is used because of long filenames, the filename I had was pretty long).

Anyway, you get the seperate parts (the means, filename*0, filename*1 etc. etc.).

With the fix below you get the full filename.

Test script:
---------------
&lt;?php
                /* (It's kinda nasty, but does the trick.) */

                // This splits on a semi-colon, if there's no preceeding backslash
                // Now works with quoted values; had to glue the \; breaks in PHP
                // the regex is already bordering on incomprehensible
                
                $splitRegex = '/([^;\'&quot;]*[\'&quot;]([^\'&quot;]*([^\'&quot;]*)*)[\'&quot;][^;\'&quot;]*|([^;]+))(;|$)/';
                preg_match_all($splitRegex, $input, $matches);
                
                /* Start fix. */
                if (preg_match('/^([^\*]+)\*0\=/is', $matches[0][0], $aMatches))
                {
	                $matches[0] = array($aMatches[1] . '=' . implode('', $matches[2]));
                }
                /* End fix. */
?&gt;

Expected result:
----------------
stdClass Object
(
    [headers] =&gt; Array
        (
            [content-type] =&gt; image/jpeg; name*0=&quot;verylongfilenamegoeshereblabla.jpg&quot;
            [content-transfer-encoding] =&gt; base64
            [content-id] =&gt; &lt;xxxxxxxxxxx@gmail.com&gt;
            [content-disposition] =&gt; inline; filename*0=&quot;verylongfilenamegoeshereblabla&quot;; filename*1=&quot;.jpg&quot;
        )

    [ctype_primary] =&gt; image
    [ctype_secondary] =&gt; jpeg
    [ctype_parameters] =&gt; Array
        (
            [name] =&gt; verylongfilenamegoeshereblabla.jpg
        )

    [disposition] =&gt; inline
    [d_parameters] =&gt; Array
        (
            [filename] =&gt; verylongfilenamegoeshereblabla.jpg
        )

)

Actual result:
--------------
stdClass Object
(
    [headers] =&gt; Array
        (
            [content-type] =&gt; image/jpeg; name*0=&quot;verylongfilenamegoeshereblabla.jpg&quot;
            [content-transfer-encoding] =&gt; base64
            [content-id] =&gt; &lt;xxxxxxxxxxx@gmail.com&gt;
            [content-disposition] =&gt; inline; filename*0=&quot;verylongfilenamegoeshereblabla&quot;; filename*1=&quot;.jpg&quot;
        )

    [ctype_primary] =&gt; image
    [ctype_secondary] =&gt; jpeg
    [ctype_parameters] =&gt; Array
        (
            [name*0] =&gt; verylongfilenamegoeshereblabla.jpg
        )

    [disposition] =&gt; inline
    [d_parameters] =&gt; Array
        (
            [filename*0] =&gt; verylongfilenamegoeshereblabla
            [filename*1] =&gt; .jpg
        )

)</pre>]]></description>
      <dc:date>2007-02-12T16:20:48+00:00</dc:date>
      <dc:creator>l0c4lh0st &amp;#x64;&amp;#111;&amp;#x74; nl &amp;#x61;&amp;#116; gmail &amp;#x64;&amp;#111;&amp;#x74; com</dc:creator>
      <dc:subject>Mail_mimeDecode Bug</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/9507">
      <title>Mail_mimeDecode: Bug 9507 [Open] Envelope FROM isn't decoded properly</title>
      <link>http://pear.php.net/bugs/9507</link>
      <content:encoded><![CDATA[<pre>Mail_mimeDecode Bug
Reported by david@...
2006-11-29T23:40:57+00:00
PHP: 5.1.6 OS: Linux Package Version: 1.3.1

Description:
------------
Mail header's envelope from isn't decoded properly

Scott PHP # grep &quot;^From &quot; ../src/debug/mime.mgt3
From - Tue Nov 28 23:42:23 2006

a) the header isn't properly split
b) it's lowercased because of (a)

Test script:
---------------
./bluelist.php &lt;  ../src/debug/mime.mgt3


/*
 * caution is prudent when using this mime stuff as the entire message is
 * loaded into memory ...
 */
$input = stream_get_contents($config['msg on disk handle']);

$params['include_bodies'] = true;
$params['decode_bodies']  = true;
$params['decode_headers'] = true;

$mime_obj = new Mail_mimeDecode($input);
$config['mime struct'] = $mime_obj-&gt;decode($params);

var_dump($config['mime struct']);


Expected result:
----------------
./bluelist.php &lt;  ../src/debug/mime.mgt3
object(stdClass)#2 (5) {
  [&quot;headers&quot;]=&gt;
  array(28) {
    [&quot;from&quot;]=&gt;
    string(27) &quot; - Tue Nov 28 23:42:23 2006&quot;


Actual result:
--------------
./bluelist.php &lt;  ../src/debug/mime.mgt3
object(stdClass)#2 (5) {
  [&quot;headers&quot;]=&gt;
  array(28) {
    [&quot;from - tue nov 28 23&quot;]=&gt;
    string(10) &quot;42:23 2006&quot;</pre>]]></content:encoded>
      <description><![CDATA[<pre>Mail_mimeDecode Bug
Reported by david@...
2006-11-29T23:40:57+00:00
PHP: 5.1.6 OS: Linux Package Version: 1.3.1

Description:
------------
Mail header's envelope from isn't decoded properly

Scott PHP # grep &quot;^From &quot; ../src/debug/mime.mgt3
From - Tue Nov 28 23:42:23 2006

a) the header isn't properly split
b) it's lowercased because of (a)

Test script:
---------------
./bluelist.php &lt;  ../src/debug/mime.mgt3


/*
 * caution is prudent when using this mime stuff as the entire message is
 * loaded into memory ...
 */
$input = stream_get_contents($config['msg on disk handle']);

$params['include_bodies'] = true;
$params['decode_bodies']  = true;
$params['decode_headers'] = true;

$mime_obj = new Mail_mimeDecode($input);
$config['mime struct'] = $mime_obj-&gt;decode($params);

var_dump($config['mime struct']);


Expected result:
----------------
./bluelist.php &lt;  ../src/debug/mime.mgt3
object(stdClass)#2 (5) {
  [&quot;headers&quot;]=&gt;
  array(28) {
    [&quot;from&quot;]=&gt;
    string(27) &quot; - Tue Nov 28 23:42:23 2006&quot;


Actual result:
--------------
./bluelist.php &lt;  ../src/debug/mime.mgt3
object(stdClass)#2 (5) {
  [&quot;headers&quot;]=&gt;
  array(28) {
    [&quot;from - tue nov 28 23&quot;]=&gt;
    string(10) &quot;42:23 2006&quot;</pre>]]></description>
      <dc:date>2006-12-16T11:50:46+00:00</dc:date>
      <dc:creator>david &amp;#x61;&amp;#116; blue-labs &amp;#x64;&amp;#111;&amp;#x74; org</dc:creator>
      <dc:subject>Mail_mimeDecode Bug</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/9100">
      <title>Mail_mimeDecode: Bug 9100 [Analyzed] Error with nested boundaries where inner boundary is a subset of the outer</title>
      <link>http://pear.php.net/bugs/9100</link>
      <content:encoded><![CDATA[<pre>Mail_mimeDecode Bug
Reported by rocca@...
2006-10-19T23:31:53+00:00
PHP: Irrelevant OS: All Package Version: 1.3.1

Description:
------------
If the input data has an inner boundary that contains a subset of the outer boundary the _boundarySplit function will incorrectly parse the data. 

For example:

Content-Type: multipart/mixed; boundary=&quot;abc&quot;

--abc
Content-Type: multipart/mixed; boundary=&quot;abc_a&quot;

--abc_a
inner

--abc_a--
outer

--abc--

...will return 'abc_a' as being at the same level as 'abc' and additionally create some garbage nodes.

Test script:
---------------
function _boundarySplit($input, $boundary) {

-  $tmp = explode('--' . $boundary, $input);
+  $tmp = preg_split(&quot;/--$boundary(\b|--)/&quot;, $input);</pre>]]></content:encoded>
      <description><![CDATA[<pre>Mail_mimeDecode Bug
Reported by rocca@...
2006-10-19T23:31:53+00:00
PHP: Irrelevant OS: All Package Version: 1.3.1

Description:
------------
If the input data has an inner boundary that contains a subset of the outer boundary the _boundarySplit function will incorrectly parse the data. 

For example:

Content-Type: multipart/mixed; boundary=&quot;abc&quot;

--abc
Content-Type: multipart/mixed; boundary=&quot;abc_a&quot;

--abc_a
inner

--abc_a--
outer

--abc--

...will return 'abc_a' as being at the same level as 'abc' and additionally create some garbage nodes.

Test script:
---------------
function _boundarySplit($input, $boundary) {

-  $tmp = explode('--' . $boundary, $input);
+  $tmp = preg_split(&quot;/--$boundary(\b|--)/&quot;, $input);</pre>]]></description>
      <dc:date>2007-02-12T16:18:11+00:00</dc:date>
      <dc:creator>rocca &amp;#x61;&amp;#116; start &amp;#x64;&amp;#111;&amp;#x74; ca</dc:creator>
      <dc:subject>Mail_mimeDecode Bug</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/7875">
      <title>Mail_mimeDecode: Bug 7875 [Analyzed] Impossible to extende Mail_mimeDecode</title>
      <link>http://pear.php.net/bugs/7875</link>
      <content:encoded><![CDATA[<pre>Mail_mimeDecode Bug
Reported by pavel.hlousek@...
2006-06-12T10:21:23+00:00
PHP: 4.4.1 OS:  Package Version: CVS

Description:
------------
The line (178) in function decode():

  $isStatic = !(isset($this) &amp;&amp; get_class($this) == __CLASS__);

disables extending the Mail_mimeDecode class. I suggest to replace it with more general:

  $isStatic = !(isset($this) &amp;&amp; is_a($this, __CLASS__));

that works perfectly.

Test script:
---------------
class My_mimeDecode extends Mail_mimeDecode {

    var $_output_encoding_headers = false;

    function My_mimeDecode($input) {
        parent::Mail_mimeDecode($input);
    }

    function decode($params = null) {
        $this-&gt;_output_encoding_headers = isset($params['output_encoding_headers']) ?                                $params['output_encoding_headers'] : false;
        return parent::decode($params);
    }

}

$decoder =&amp; new My_mimeDecode($my_email_message);
$email = $decoder-&gt;decode();


Expected result:
----------------
A decoded email message in $email.

Actual result:
--------------
Raises error (line 189):

  Called statically and no input given</pre>]]></content:encoded>
      <description><![CDATA[<pre>Mail_mimeDecode Bug
Reported by pavel.hlousek@...
2006-06-12T10:21:23+00:00
PHP: 4.4.1 OS:  Package Version: CVS

Description:
------------
The line (178) in function decode():

  $isStatic = !(isset($this) &amp;&amp; get_class($this) == __CLASS__);

disables extending the Mail_mimeDecode class. I suggest to replace it with more general:

  $isStatic = !(isset($this) &amp;&amp; is_a($this, __CLASS__));

that works perfectly.

Test script:
---------------
class My_mimeDecode extends Mail_mimeDecode {

    var $_output_encoding_headers = false;

    function My_mimeDecode($input) {
        parent::Mail_mimeDecode($input);
    }

    function decode($params = null) {
        $this-&gt;_output_encoding_headers = isset($params['output_encoding_headers']) ?                                $params['output_encoding_headers'] : false;
        return parent::decode($params);
    }

}

$decoder =&amp; new My_mimeDecode($my_email_message);
$email = $decoder-&gt;decode();


Expected result:
----------------
A decoded email message in $email.

Actual result:
--------------
Raises error (line 189):

  Called statically and no input given</pre>]]></description>
      <dc:date>2007-02-12T16:17:18+00:00</dc:date>
      <dc:creator>pavel &amp;#x64;&amp;#111;&amp;#x74; hlousek &amp;#x61;&amp;#116; gmail &amp;#x64;&amp;#111;&amp;#x74; com</dc:creator>
      <dc:subject>Mail_mimeDecode Bug</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/7709">
      <title>Mail_mimeDecode: Bug 7709 [Open] multipart/mixed with attachments are not decoded properly</title>
      <link>http://pear.php.net/bugs/7709</link>
      <content:encoded><![CDATA[<pre>Mail_mimeDecode Bug
Reported by jthijssen@...
2006-05-23T14:48:24+00:00
PHP: 4.4.1 OS: Debian (3.1) Package Version: CVS

Description:
------------
It looks like that the _boundaresplit() function splits the input on the boundaries, but the first and last part found is not returned (for $i = 1, $i &lt; count ($tmp) -1; $i++)...)
It should not rule out any parts returned by the split. A quick solution would be to modify the line to &quot;for $i=1; $i&lt;=count($tmp)-1; $i++).

However, it will return the attachment but also returns a empty part which is found between &quot;------=_NextPart_000_002C_8A6A229E.7935106B--

------=_NextPart_000_002C_932E5A3C.95C782A3&quot;. 

Maybe a better solution would be to check if the last part contains text, if so, return that part, otherwise skip it.

Test script:
---------------
To: demo@example.org
Subject: subject 
From: me &lt;info@example.org&gt;
Sender: me &lt;info@example.org&gt;
X-Mailer: NoxLogic/Automailer
X-NoxVersion: 1.00.2. (running)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary=&quot;----=_NextPart_000_002C_932E5A3C.95C782A3&quot;

This is a multi-part message in MIME format.

------=_NextPart_000_002C_932E5A3C.95C782A3
Content-Type: multipart/alternative; boundary=&quot;----=_NextPart_000_002C_8A6A229E.7935106B&quot;


------=_NextPart_000_002C_8A6A229E.7935106B
Content-Type: text/plain; charset='ISO-8859-1'
Content-Transfer-Encoding: 7bit

This is the text version of the email

------=_NextPart_000_002C_8A6A229E.7935106B
Content-Type: text/html; charset='ISO-8859-1'

&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;&gt;
&lt;html&gt;
&lt;head&gt;
 &lt;meta content=&quot;text/html;charset=ISO-8859-1&quot; http-equiv=&quot;Content-Type&quot;&gt;
&lt;/head&gt;
&lt;body bgcolor=&quot;#ffffff&quot; text=&quot;#000000&quot;&gt;

This is the &lt;strong&gt;HTML&lt;/strong&gt; &lt;h1&gt;Version&lt;/h1&gt; of the email
&lt;/body&gt;
&lt;/html&gt;
------=_NextPart_000_002C_8A6A229E.7935106B--

------=_NextPart_000_002C_932E5A3C.95C782A3
Content-Type: application/octet-stream; name=&quot;test.pdf&quot;
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename=&quot;test.pdf&quot;

JVBEBOGUSBASE64DATARi0xBOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATAverO07JhripPlxrk5U6iSWSUa+L96wDX5UA1hmhnQSQusiHkyEMPWKkqviYOLhK6YsYjV21sB5bW/JVigMcjH+ebgW4HWQPRemIfuH0Gl+epxuosgHgs6h189wCfaDVgSd0+ii+Ann+mU2nCys7JaLFlWBwhYuzMo0ggWugJ7adwdPbwk0bvnxlFZSw8SU3ANzzjpTsWdBg5Uks5Kq0ZQEC/Esp7PRT38R7b+8b7JrFEpVPY+5mOZSOLS03fRb5su/0dNJSnfdy+DxCENppbrH5R5W+Su8fc8bKjeSJjoj98kEW4X7azGVmRbhuSyZLmPF1BbgXKxg9g8pr3XVpp8nDh4lVby/ZSqUs+1SKmsfhIDfpzC+Fxm3OUWmmvHig8wvJ5PyCrbm5qtPv23OQsTFIkASJApsqLwA5VD/N8D94fsn+ilK0okIkyG8p52pxWnNfCWronwhJuH/iSfJ/iFarCyMeHasL4mRUWSGJBrIAYmMG3GsVmbniSwGON7kkX4EcBx8lPD1B0zLhQ4uUGlWFFUXjPAqoXgRxq30zMepkcTm1SWZMPG37CO1FQ8xYZMURumjhxIHAdp+Sp0jjk6qyFkRXUYoNmAIvqTy1VxOoOlcIk4qGNm4FhGxa3kubmpB1T02uQ2UNYnZdDSaDcrw4eyl9Mx1Mjic2kvUsEEeLitHGiMcqMXVQDaz+Svd8vh7lgbqQTDETFMRx0q1wD/eNQ5HVPTeUqpka5FRg6goeDDkfbUknV3T8qNHIzOjCzK0ZII9FL6ZjqZHE5tL+bvGDjYj5Czo50kxKrBizW4WApbi4kmL0pOsg0vJG8hU8xqHD2AVVi3bo2GQSxwkODcEozAH0MSKuS9W9PzRtFKztG4sylDYg0vpmOpkcT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bWFnZUMgL0ltYWdlSV0KL0ZvbnQgPDwKL0YxIDUgMCBSCi9GMiA2IDAgUgovRjMgNyAwIFIKPj4KL1hPYmplY3QgPDwKL0kxIDggMCBSCj4+Cj4+CmVuZG9iago5IDAgb2JqCjw8Ci9Qcm9kdWNlciAoRlBERiAxLjUyKQovVGl0bGUgKEVaU2hvcHBpbmcgT3JkZXIgI1dFQjAwMTEzMykKL1N1YmplY3QgKEVaU2hvcHBpbmcgT3JkZXIgI1dFQjAwMTEzMykKL0F1dGhvciAoTm94RW5naW5lKQovQ3JlYXRvciAoRVpTaG9wcGluZykKL0NyZWF0aW9uRGF0ZSAoRDoyMDA2MDMxNTEyMDk0MikKPj4KZW5kb2JqCjEwIDAgb2JqCjw8Ci9UeXBlIC9DYXRhbG9nCi9QYWdlcyAxIDAgUgovT3BlbkFjdGlvbiBbMyAwIFIgL0ZpdF0KL1BhZ2VMYXlvdXQgL1NpbmdsZVBhZ2UKPj4KZW5kb2JqCnhyZWYKMCAxMQowMDAwMDAwMDAwIDY1NTM1IGYgCjAwMDAwMDEwNzkgMDAwMDAgbiAKMDAwMDAwNTMyNiAwMDAwMCBuIAowMDAwMDAwMDA5IDAwMDAwIG4gCjAwMDAwMDAwODcgMDAwMDAgbiAKMDAwMDAwMTE2NiAwMDAwMCBuIAowMDAwMDAxMjYyIDAwMDAwIG4gCjAwMDAwMDEzNjMgMDAwMDAgbiAKMDAwMDAwMTQ2NyAwMDAwMCBuIAowMDAwMDA1NDU5IDAwMDAwIG4gCjAwMDAwMDU2NTMgMDAwMDAgbiAKdHJhaWxlcgo8PAovU2l6ZSAxMQovUm9vdCAxMCAwIFIKL0luZm8gOSAwIFIKPj4Kc3RhcnR4cmVmCjU3NTIKJSVFT0YK






Expected result:
----------------
To: demo@example.org
Subject: subject 
From: me &lt;info@example.org&gt;
Sender: me &lt;info@example.org&gt;
X-Mailer: NoxLogic/Automailer
X-NoxVersion: 1.00.2. (running)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary=&quot;----=_NextPart_000_002C_932E5A3C.95C782A3&quot;

This is a multi-part message in MIME format.

------=_NextPart_000_002C_932E5A3C.95C782A3
Content-Type: multipart/alternative; boundary=&quot;----=_NextPart_000_002C_8A6A229E.7935106B&quot;


------=_NextPart_000_002C_8A6A229E.7935106B
Content-Type: text/plain; charset='ISO-8859-1'
Content-Transfer-Encoding: 7bit

This is the text version of the email
stdClass Object
(
    [headers] =&gt; Array
        (
            [to] =&gt; demo@example.org
            [subject] =&gt; subject 
            [from] =&gt; me 
            [sender] =&gt; me 
            [x-mailer] =&gt; NoxLogic/Automailer
            [x-noxversion] =&gt; 1.00.2. (running)
            [mime-version] =&gt; 1.0
            [content-type] =&gt; multipart/mixed; boundary=&quot;----=_NextPart_000_002C_932E5A3C.95C782A3&quot;
        )

    [ctype_primary] =&gt; multipart
    [ctype_secondary] =&gt; mixed
    [ctype_parameters] =&gt; Array
        (
            [boundary] =&gt; ----=_NextPart_000_002C_932E5A3C.95C782A3
        )

    [parts] =&gt; Array
        (
            [0] =&gt; stdClass Object
                (
                    [headers] =&gt; Array
                        (
                            [content-type] =&gt; multipart/alternative; boundary=&quot;----=_NextPart_000_002C_8A6A229E.7935106B&quot;
                        )

                    [ctype_primary] =&gt; multipart
                    [ctype_secondary] =&gt; alternative
                    [ctype_parameters] =&gt; Array
                        (
                            [boundary] =&gt; ----=_NextPart_000_002C_8A6A229E.7935106B
                        )

                    [parts] =&gt; Array
                        (
                            [0] =&gt; stdClass Object
                                (
                                    [headers] =&gt; Array
                                        (
                                            [content-type] =&gt; text/plain; charset=&quot;ISO-8859-1&quot;
                                            [content-transfer-encoding] =&gt; 7bit
                                        )

                                    [ctype_primary] =&gt; text
                                    [ctype_secondary] =&gt; plain
                                    [ctype_parameters] =&gt; Array
                                        (
                                            [charset] =&gt; ISO-8859-1
                                        )

                                    [body] =&gt; This is the text version of the email


                                )

                            [1] =&gt; stdClass Object
                                (
                                    [headers] =&gt; Array
                                        (
                                            [content-type] =&gt; text/html; charset=&quot;ISO-8859-1&quot;
                                        )

                                    [ctype_primary] =&gt; text
                                    [ctype_secondary] =&gt; html
                                    [ctype_parameters] =&gt; Array
                                        (
                                            [charset] =&gt; ISO-8859-1
                                        )

                                    [body] =&gt; 


 


This is the HTML 
Version
 of the email
)


                        )

                )

            [1] =&gt; stdClass Object
                (
                    [headers] =&gt; Array
                        (
                            [content-type] =&gt; application/octet-stream; name=&quot;test.pdf&quot;
                            [content-transfer-encoding] =&gt; base64
                            [content-disposition] =&gt; attachment; filename=&quot;test.pdf&quot;
                        )

                    [ctype_primary] =&gt; application
                    [ctype_secondary] =&gt; octet-stream
                    [ctype_parameters] =&gt; Array
                        (
                            [name] =&gt; test.pdf
                        )

                    [disposition] =&gt; attachment
                    [d_parameters] =&gt; Array
                        (
                            [filename] =&gt; test.pdf
                        )

                    [body] =&gt; JVBEBOGUSBASE64DATARi0xBOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATAverO07JhripPlxrk5U6iSWSUa+L96wDX5UA1hmhnQSQusiHkyEMPWKkqviYOLhK6YsYjV21sB5bW/JVigMcjH+ebgW4HWQPRemIfuH0Gl+epxuosgHgs6h189wCfaDVgSd0+ii+Ann+mU2nCys7JaLFlWBwhYuzMo0ggWugJ7adw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oRDoyMDA2MDMxNTEyMDk0MikKPj4KZW5kb2JqCjEwIDAgb2JqCjw8Ci9UeXBlIC9DYXRhbG9nCi9QYWdlcyAxIDAgUgovT3BlbkFjdGlvbiBbMyAwIFIgL0ZpdF0KL1BhZ2VMYXlvdXQgL1NpbmdsZVBhZ2UKPj4KZW5kb2JqCnhyZWYKMCAxMQowMDAwMDAwMDAwIDY1NTM1IGYgCjAwMDAwMDEwNzkgMDAwMDAgbiAKMDAwMDAwNTMyNiAwMDAwMCBuIAowMDAwMDAwMDA5IDAwMDAwIG4gCjAwMDAwMDAwODcgMDAwMDAgbiAKMDAwMDAwMTE2NiAwMDAwMCBuIAowMDAwMDAxMjYyIDAwMDAwIG4gCjAwMDAwMDEzNjMgMDAwMDAgbiAKMDAwMDAwMTQ2NyAwMDAwMCBuIAowMDAwMDA1NDU5IDAwMDAwIG4gCjAwMDAwMDU2NTMgMDAwMDAgbiAKdHJhaWxlcgo8PAovU2l6ZSAxMQovUm9vdCAxMCAwIFIKL0luZm8gOSAwIFIKPj4Kc3RhcnR4cmVmCjU3NTIKJSVFT0YK
                )

        )

)
------=_NextPart_000_002C_8A6A229E.7935106B
Content-Type: text/html; charset='ISO-8859-1'

&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;&gt;
&lt;html&gt;
&lt;head&gt;
 &lt;meta content=&quot;text/html;charset=ISO-8859-1&quot; http-equiv=&quot;Content-Type&quot;&gt;
&lt;/head&gt;
&lt;body bgcolor=&quot;#ffffff&quot; text=&quot;#000000&quot;&gt;

This is the &lt;strong&gt;HTML&lt;/strong&gt; &lt;h1&gt;Version&lt;/h1&gt; of the email
&lt;/body&gt;
&lt;/html&gt;
------=_NextPart_000_002C_8A6A229E.7935106B--
------=_NextPart_000_002C_932E5A3C.95C782A3
Content-Type: application/octet-stream; name=&quot;test.pdf&quot;
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename=&quot;test.pdf&quot;

JVBEBOGUSBASE64DATARi0xBOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATAverO07JhripPlxrk5U6iSWSUa+L96wDX5UA1hmhnQSQusiHkyEMPWKkqviYOLhK6YsYjV21sB5bW/JVigMcjH+ebgW4HWQPRemIfuH0Gl+epxuosgHgs6h189wCfaDVgSd0+ii+Ann+mU2nCys7JaLFlWBwhYuzMo0ggWugJ7adwdPbwk0bvnxlFZSw8SU3ANzzjpTsWdBg5Uks5Kq0ZQEC/Esp7PRT38R7b+8b7JrFEpVPY+5mOZSOLS03fRb5su/0dNJSnfdy+DxCENppbrH5R5W+Su8fc8bKjeSJjoj98kEW4X7azGVmRbhuSyZLmPF1BbgXKxg9g8pr3XVpp8nDh4lVby/ZSqUs+1SKmsfhIDfpzC+Fxm3OUWmmvHig8wvJ5PyCrbm5qtPv23OQsTFIkASJApsqLwA5VD/N8D94fsn+ilK0okIkyG8p52pxWnNfCWronwhJuH/iSfJ/iFarCyMeHasL4mRUWSGJBrIAYmMG3GsVmbniSwGON7kkX4EcBx8lPD1B0zLhQ4uUGlWFFUXjPAqoXgRxq30zMepkcTm1SWZMPG37CO1FQ8xYZMURumjhxIHAdp+Sp0jjk6qyFkRXUYoNmAIvqTy1VxOoOlcIk4qGNm4FhGxa3kubmpB1T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wMDU2NTMgMDAwMDAgbiAKdHJhaWxlcgo8PAovU2l6ZSAxMQovUm9vdCAxMCAwIFIKL0luZm8gOSAwIFIKPj4Kc3RhcnR4cmVmCjU3NTIKJSVFT0YK


Actual result:
--------------
stdClass Object
(
    [headers] =&gt; Array
        (
            [to] =&gt; demo@example.org
            [subject] =&gt; subject 
            [from] =&gt; me 
            [sender] =&gt; me 
            [x-mailer] =&gt; NoxLogic/Automailer
            [x-noxversion] =&gt; 1.00.2. (running)
            [mime-version] =&gt; 1.0
            [content-type] =&gt; multipart/mixed; boundary=&quot;----=_NextPart_000_002C_932E5A3C.95C782A3&quot;
        )

    [ctype_primary] =&gt; multipart
    [ctype_secondary] =&gt; mixed
    [ctype_parameters] =&gt; Array
        (
            [boundary] =&gt; ----=_NextPart_000_002C_932E5A3C.95C782A3
        )

    [parts] =&gt; Array
        (
            [0] =&gt; stdClass Object
                (
                    [headers] =&gt; Array
                        (
                            [content-type] =&gt; multipart/alternative; boundary=&quot;----=_NextPart_000_002C_8A6A229E.7935106B&quot;
                        )

                    [ctype_primary] =&gt; multipart
                    [ctype_secondary] =&gt; alternative
                    [ctype_parameters] =&gt; Array
                        (
                            [boundary] =&gt; ----=_NextPart_000_002C_8A6A229E.7935106B
                        )

                    [parts] =&gt; Array
                        (
                            [0] =&gt; stdClass Object
                                (
                                    [headers] =&gt; Array
                                        (
                                            [content-type] =&gt; text/plain; charset=&quot;ISO-8859-1&quot;
                                            [content-transfer-encoding] =&gt; 7bit
                                        )

                                    [ctype_primary] =&gt; text
                                    [ctype_secondary] =&gt; plain
                                    [ctype_parameters] =&gt; Array
                                        (
                                            [charset] =&gt; ISO-8859-1
                                        )

                                    [body] =&gt; This is the text version of the email


                                )

                            [1] =&gt; stdClass Object
                                (
                                    [headers] =&gt; Array
                                        (
                                            [content-type] =&gt; text/html; charset=&quot;ISO-8859-1&quot;
                                        )

                                    [ctype_primary] =&gt; text
                                    [ctype_secondary] =&gt; html
                                    [ctype_parameters] =&gt; Array
                                        (
                                            [charset] =&gt; ISO-8859-1
                                        )

                                    [body] =&gt; 


 


This is the HTML 
Version
 of the email
)

                        )

                )

        )

)</pre>]]></content:encoded>
      <description><![CDATA[<pre>Mail_mimeDecode Bug
Reported by jthijssen@...
2006-05-23T14:48:24+00:00
PHP: 4.4.1 OS: Debian (3.1) Package Version: CVS

Description:
------------
It looks like that the _boundaresplit() function splits the input on the boundaries, but the first and last part found is not returned (for $i = 1, $i &lt; count ($tmp) -1; $i++)...)
It should not rule out any parts returned by the split. A quick solution would be to modify the line to &quot;for $i=1; $i&lt;=count($tmp)-1; $i++).

However, it will return the attachment but also returns a empty part which is found between &quot;------=_NextPart_000_002C_8A6A229E.7935106B--

------=_NextPart_000_002C_932E5A3C.95C782A3&quot;. 

Maybe a better solution would be to check if the last part contains text, if so, return that part, otherwise skip it.

Test script:
---------------
To: demo@example.org
Subject: subject 
From: me &lt;info@example.org&gt;
Sender: me &lt;info@example.org&gt;
X-Mailer: NoxLogic/Automailer
X-NoxVersion: 1.00.2. (running)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary=&quot;----=_NextPart_000_002C_932E5A3C.95C782A3&quot;

This is a multi-part message in MIME format.

------=_NextPart_000_002C_932E5A3C.95C782A3
Content-Type: multipart/alternative; boundary=&quot;----=_NextPart_000_002C_8A6A229E.7935106B&quot;


------=_NextPart_000_002C_8A6A229E.7935106B
Content-Type: text/plain; charset='ISO-8859-1'
Content-Transfer-Encoding: 7bit

This is the text version of the email

------=_NextPart_000_002C_8A6A229E.7935106B
Content-Type: text/html; charset='ISO-8859-1'

&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;&gt;
&lt;html&gt;
&lt;head&gt;
 &lt;meta content=&quot;text/html;charset=ISO-8859-1&quot; http-equiv=&quot;Content-Type&quot;&gt;
&lt;/head&gt;
&lt;body bgcolor=&quot;#ffffff&quot; text=&quot;#000000&quot;&gt;

This is the &lt;strong&gt;HTML&lt;/strong&gt; &lt;h1&gt;Version&lt;/h1&gt; of the email
&lt;/body&gt;
&lt;/html&gt;
------=_NextPart_000_002C_8A6A229E.7935106B--

------=_NextPart_000_002C_932E5A3C.95C782A3
Content-Type: application/octet-stream; name=&quot;test.pdf&quot;
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename=&quot;test.pdf&quot;

JVBEBOGUSBASE64DATARi0xBOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATAverO07JhripPlxrk5U6iSWSUa+L96wDX5UA1hmhnQSQusiHkyEMPWKkqviYOLhK6YsYjV21sB5bW/JVigMcjH+ebgW4HWQPRemIfuH0Gl+epxuosgHgs6h189wCfaDVgSd0+ii+Ann+mU2nCys7JaLFlWBwhYuzMo0ggWugJ7adwdPbwk0bvnxlFZSw8SU3ANzzjpTsWdBg5Uks5Kq0ZQEC/Esp7PRT38R7b+8b7JrFEpVPY+5mOZSOLS03fRb5su/0dNJSnfdy+DxCENppbrH5R5W+Su8fc8bKjeSJjoj98kEW4X7azGVmRbhuSyZLmPF1BbgXKxg9g8pr3XVpp8nDh4lVby/ZSqUs+1SKmsfhIDfpzC+Fxm3OUWmmvHig8wvJ5PyCrbm5qtPv23OQsTFIkASJApsqLwA5VD/N8D94fsn+ilK0okIkyG8p52p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owMDAwMDAwMDA5IDAwMDAwIG4gCjAwMDAwMDAwODcgMDAwMDAgbiAKMDAwMDAwMTE2NiAwMDAwMCBuIAowMDAwMDAxMjYyIDAwMDAwIG4gCjAwMDAwMDEzNjMgMDAwMDAgbiAKMDAwMDAwMTQ2NyAwMDAwMCBuIAowMDAwMDA1NDU5IDAwMDAwIG4gCjAwMDAwMDU2NTMgMDAwMDAgbiAKdHJhaWxlcgo8PAovU2l6ZSAxMQovUm9vdCAxMCAwIFIKL0luZm8gOSAwIFIKPj4Kc3RhcnR4cmVmCjU3NTIKJSVFT0YK






Expected result:
----------------
To: demo@example.org
Subject: subject 
From: me &lt;info@example.org&gt;
Sender: me &lt;info@example.org&gt;
X-Mailer: NoxLogic/Automailer
X-NoxVersion: 1.00.2. (running)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary=&quot;----=_NextPart_000_002C_932E5A3C.95C782A3&quot;

This is a multi-part message in MIME format.

------=_NextPart_000_002C_932E5A3C.95C782A3
Content-Type: multipart/alternative; boundary=&quot;----=_NextPart_000_002C_8A6A229E.7935106B&quot;


------=_NextPart_000_002C_8A6A229E.7935106B
Content-Type: text/plain; charset='ISO-8859-1'
Content-Transfer-Encoding: 7bit

This is the text version of the email
stdClass Object
(
    [headers] =&gt; Array
        (
            [to] =&gt; demo@example.org
            [subject] =&gt; subject 
            [from] =&gt; me 
            [sender] =&gt; me 
            [x-mailer] =&gt; NoxLogic/Automailer
            [x-noxversion] =&gt; 1.00.2. (running)
            [mime-version] =&gt; 1.0
            [content-type] =&gt; multipart/mixed; boundary=&quot;----=_NextPart_000_002C_932E5A3C.95C782A3&quot;
        )

    [ctype_primary] =&gt; multipart
    [ctype_secondary] =&gt; mixed
    [ctype_parameters] =&gt; Array
        (
            [boundary] =&gt; ----=_NextPart_000_002C_932E5A3C.95C782A3
        )

    [parts] =&gt; Array
        (
            [0] =&gt; stdClass Object
                (
                    [headers] =&gt; Array
                        (
                            [content-type] =&gt; multipart/alternative; boundary=&quot;----=_NextPart_000_002C_8A6A229E.7935106B&quot;
                        )

                    [ctype_primary] =&gt; multipart
                    [ctype_secondary] =&gt; alternative
                    [ctype_parameters] =&gt; Array
                        (
                            [boundary] =&gt; ----=_NextPart_000_002C_8A6A229E.7935106B
                        )

                    [parts] =&gt; Array
                        (
                            [0] =&gt; stdClass Object
                                (
                                    [headers] =&gt; Array
                                        (
                                            [content-type] =&gt; text/plain; charset=&quot;ISO-8859-1&quot;
                                            [content-transfer-encoding] =&gt; 7bit
                                        )

                                    [ctype_primary] =&gt; text
                                    [ctype_secondary] =&gt; plain
                                    [ctype_parameters] =&gt; Array
                                        (
                                            [charset] =&gt; ISO-8859-1
                                        )

                                    [body] =&gt; This is the text version of the email


                                )

                            [1] =&gt; stdClass Object
                                (
                                    [headers] =&gt; Array
                                        (
                                            [content-type] =&gt; text/html; charset=&quot;ISO-8859-1&quot;
                                        )

                                    [ctype_primary] =&gt; text
                                    [ctype_secondary] =&gt; html
                                    [ctype_parameters] =&gt; Array
                                        (
                                            [charset] =&gt; ISO-8859-1
                                        )

                                    [body] =&gt; 


 


This is the HTML 
Version
 of the email
)


                        )

                )

            [1] =&gt; stdClass Object
                (
                    [headers] =&gt; Array
                        (
                            [content-type] =&gt; application/octet-stream; name=&quot;test.pdf&quot;
                            [content-transfer-encoding] =&gt; base64
                            [content-disposition] =&gt; attachment; filename=&quot;test.pdf&quot;
                        )

                    [ctype_primary] =&gt; application
                    [ctype_secondary] =&gt; octet-stream
                    [ctype_parameters] =&gt; Array
                        (
                            [name] =&gt; test.pdf
                        )

                    [disposition] =&gt; attachment
                    [d_parameters] =&gt; Array
                        (
                            [filename] =&gt; test.pdf
                        )

                    [body] =&gt; JVBEBOGUSBASE64DATARi0xBOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATAverO07JhripPlxrk5U6iSWSUa+L96wDX5UA1hmhnQSQusiHkyEMPWKkqviYOLhK6YsYjV21sB5bW/JVigMcjH+ebgW4HWQPRemIfuH0Gl+epxuosgHgs6h189wCfaDVgSd0+ii+Ann+mU2nCys7JaLFlWBwhYuzMo0ggWugJ7adwdPbwk0bvnxlFZSw8SU3ANzzjpTsWdBg5Uks5Kq0ZQEC/Esp7PRT38R7b+8b7JrFEpVPY+5mOZSOLS03fRb5su/0dNJSnfdy+DxCENppbrH5R5W+Su8fc8bKjeSJjoj98kEW4X7azGVmRbhuSyZLmPF1BbgXKxg9g8pr3XVpp8nDh4lVby/ZSqUs+1SKmsfhIDfpzC+Fxm3OUWmmvHig8wvJ5PyCrbm5qtPv23OQsTFIkASJApsqLwA5VD/N8D94fsn+ilK0okIkyG8p52pxWnNfCWronwhJuH/iSfJ/iFarCyMeHasL4mRUWSGJBrIAYmMG3GsVmbniSwGON7kkX4EcBx8lPD1B0zLhQ4uUGlWFFUXjPAqoXgRxq30zMepkcTm1SWZMPG37CO1FQ8xYZMURumjhxIHAdp+Sp0jjk6qyFkRXUYoNmAIvqTy1VxOoOlcIk4qGNm4FhGxa3kubmpB1T02uQ2UNYnZdDSaDcrw4eyl9Mx1Mjic2kvUsEEeLitHGiMcqMXVQDaz+Svd8vh7lgbqQTDETFMRx0q1wD/eNQ5HVPTeUqpka5FRg6goeDDkfbUknV3T8qNHIzOjCzK0ZII9FL6ZjqZHE5tL+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7935106B
Content-Type: text/html; charset='ISO-8859-1'

&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;&gt;
&lt;html&gt;
&lt;head&gt;
 &lt;meta content=&quot;text/html;charset=ISO-8859-1&quot; http-equiv=&quot;Content-Type&quot;&gt;
&lt;/head&gt;
&lt;body bgcolor=&quot;#ffffff&quot; text=&quot;#000000&quot;&gt;

This is the &lt;strong&gt;HTML&lt;/strong&gt; &lt;h1&gt;Version&lt;/h1&gt; of the email
&lt;/body&gt;
&lt;/html&gt;
------=_NextPart_000_002C_8A6A229E.7935106B--
------=_NextPart_000_002C_932E5A3C.95C782A3
Content-Type: application/octet-stream; name=&quot;test.pdf&quot;
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename=&quot;test.pdf&quot;

JVBEBOGUSBASE64DATARi0xBOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATABOGUSBASE64DATAverO07JhripPlxrk5U6iSWSUa+L96wDX5UA1hmhnQSQusiHkyEMPWKkqviYOLhK6YsYjV21sB5bW/JVigMcjH+ebgW4HWQPRemIfuH0Gl+epxuosgHgs6h189wCfaDVgSd0+ii+Ann+mU2nCys7JaLFlWBwhYuzMo0ggWugJ7adwdPbwk0bvnxlFZSw8SU3ANzzjp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j4KZW5kb2JqCjEwIDAgb2JqCjw8Ci9UeXBlIC9DYXRhbG9nCi9QYWdlcyAxIDAgUgovT3BlbkFjdGlvbiBbMyAwIFIgL0ZpdF0KL1BhZ2VMYXlvdXQgL1NpbmdsZVBhZ2UKPj4KZW5kb2JqCnhyZWYKMCAxMQowMDAwMDAwMDAwIDY1NTM1IGYgCjAwMDAwMDEwNzkgMDAwMDAgbiAKMDAwMDAwNTMyNiAwMDAwMCBuIAowMDAwMDAwMDA5IDAwMDAwIG4gCjAwMDAwMDAwODcgMDAwMDAgbiAKMDAwMDAwMTE2NiAwMDAwMCBuIAowMDAwMDAxMjYyIDAwMDAwIG4gCjAwMDAwMDEzNjMgMDAwMDAgbiAKMDAwMDAwMTQ2NyAwMDAwMCBuIAowMDAwMDA1NDU5IDAwMDAwIG4gCjAwMDAwMDU2NTMgMDAwMDAgbiAKdHJhaWxlcgo8PAovU2l6ZSAxMQovUm9vdCAxMCAwIFIKL0luZm8gOSAwIFIKPj4Kc3RhcnR4cmVmCjU3NTIKJSVFT0YK


Actual result:
--------------
stdClass Object
(
    [headers] =&gt; Array
        (
            [to] =&gt; demo@example.org
            [subject] =&gt; subject 
            [from] =&gt; me 
            [sender] =&gt; me 
            [x-mailer] =&gt; NoxLogic/Automailer
            [x-noxversion] =&gt; 1.00.2. (running)
            [mime-version] =&gt; 1.0
            [content-type] =&gt; multipart/mixed; boundary=&quot;----=_NextPart_000_002C_932E5A3C.95C782A3&quot;
        )

    [ctype_primary] =&gt; multipart
    [ctype_secondary] =&gt; mixed
    [ctype_parameters] =&gt; Array
        (
            [boundary] =&gt; ----=_NextPart_000_002C_932E5A3C.95C782A3
        )

    [parts] =&gt; Array
        (
            [0] =&gt; stdClass Object
                (
                    [headers] =&gt; Array
                        (
                            [content-type] =&gt; multipart/alternative; boundary=&quot;----=_NextPart_000_002C_8A6A229E.7935106B&quot;
                        )

                    [ctype_primary] =&gt; multipart
                    [ctype_secondary] =&gt; alternative
                    [ctype_parameters] =&gt; Array
                        (
                            [boundary] =&gt; ----=_NextPart_000_002C_8A6A229E.7935106B
                        )

                    [parts] =&gt; Array
                        (
                            [0] =&gt; stdClass Object
                                (
                                    [headers] =&gt; Array
                                        (
                                            [content-type] =&gt; text/plain; charset=&quot;ISO-8859-1&quot;
                                            [content-transfer-encoding] =&gt; 7bit
                                        )

                                    [ctype_primary] =&gt; text
                                    [ctype_secondary] =&gt; plain
                                    [ctype_parameters] =&gt; Array
                                        (
                                            [charset] =&gt; ISO-8859-1
                                        )

                                    [body] =&gt; This is the text version of the email


                                )

                            [1] =&gt; stdClass Object
                                (
                                    [headers] =&gt; Array
                                        (
                                            [content-type] =&gt; text/html; charset=&quot;ISO-8859-1&quot;
                                        )

                                    [ctype_primary] =&gt; text
                                    [ctype_secondary] =&gt; html
                                    [ctype_parameters] =&gt; Array
                                        (
                                            [charset] =&gt; ISO-8859-1
                                        )

                                    [body] =&gt; 


 


This is the HTML 
Version
 of the email
)

                        )

                )

        )

)</pre>]]></description>
      <dc:date>2006-05-23T14:48:24+00:00</dc:date>
      <dc:creator>jthijssen &amp;#x61;&amp;#116; noxlogic &amp;#x64;&amp;#111;&amp;#x74; nl</dc:creator>
      <dc:subject>Mail_mimeDecode Bug</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/7676">
      <title>Mail_mimeDecode: Bug 7676 [Analyzed] Content-Type decoding isn't compliant with RFC 2045</title>
      <link>http://pear.php.net/bugs/7676</link>
      <content:encoded><![CDATA[<pre>Mail_mimeDecode Bug
Reported by priappub@...
2006-05-19T21:22:19+00:00
PHP: 5.1.4 OS: ALL Package Version: 1.3.1

Description:
------------
The RFC 2045 says: 
 
&quot;Default RFC 822 messages without a MIME Content-Type 
header are taken by this protocol to be plain text in the 
US-ASCII character set, which can be explicitly specified 
as: 
 
     Content-type: text/plain; charset=us-ascii 
 
This default is assumed if no Content-Type header field is 
specified. It is also recommend that this default be 
assumed when a syntactically invalid Content-Type header 
field is encountered.&quot; 
 
In function _decode, if there is no Content-Type, it's OK, 
we have: 
$ctype = explode('/', $default_ctype); 
            $return-&gt;ctype_primary   = $ctype[0]; 
            $return-&gt;ctype_secondary = $ctype[1]; 
 
But if we have &quot;Content-Type: text&quot; which is not RFC 
compliant, we haven't this piece of code and 
ctype_secondary isn't defined.</pre>]]></content:encoded>
      <description><![CDATA[<pre>Mail_mimeDecode Bug
Reported by priappub@...
2006-05-19T21:22:19+00:00
PHP: 5.1.4 OS: ALL Package Version: 1.3.1

Description:
------------
The RFC 2045 says: 
 
&quot;Default RFC 822 messages without a MIME Content-Type 
header are taken by this protocol to be plain text in the 
US-ASCII character set, which can be explicitly specified 
as: 
 
     Content-type: text/plain; charset=us-ascii 
 
This default is assumed if no Content-Type header field is 
specified. It is also recommend that this default be 
assumed when a syntactically invalid Content-Type header 
field is encountered.&quot; 
 
In function _decode, if there is no Content-Type, it's OK, 
we have: 
$ctype = explode('/', $default_ctype); 
            $return-&gt;ctype_primary   = $ctype[0]; 
            $return-&gt;ctype_secondary = $ctype[1]; 
 
But if we have &quot;Content-Type: text&quot; which is not RFC 
compliant, we haven't this piece of code and 
ctype_secondary isn't defined.</pre>]]></description>
      <dc:date>2007-02-12T16:16:28+00:00</dc:date>
      <dc:creator>priappub &amp;#x61;&amp;#116; yahoo &amp;#x64;&amp;#111;&amp;#x74; fr</dc:creator>
      <dc:subject>Mail_mimeDecode Bug</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/7242">
      <title>Mail_mimeDecode: Bug 7242 [Analyzed] Mail_mimeDecode: Notice: Uninitialized string offset</title>
      <link>http://pear.php.net/bugs/7242</link>
      <content:encoded><![CDATA[<pre>Mail_mimeDecode Bug
Reported by luke.richards@...
2006-03-29T04:00:04+00:00
PHP: 4.3.11 OS: Linux Package Version: 1.3.1

Description:
------------
468c468
&lt;                     if (is_array($param_value) AND $param_value[0] == '&quot;') {
---
&gt;                     if ($param_value[0] == '&quot;') {



Test script:
---------------
&lt;?php

    require_once(&quot;Mail/mimeDecode.php&quot;);
    
    // this is an email we received
    $string = file_get_contents(&quot;http://www.emailcenteruk.com/pear_report/example_email.eml&quot;);
    
    $params = array();
    $params['include_bodies'] = true;
    $params['decode_bodies']  = true;
    $params['decode_headers'] = true;
    
    $parser = new Mail_mimeDecode($string);
    $structure = $parser-&gt;decode($params);

    print_r($structure);
?&gt;

Expected result:
----------------
The structure of the email is printed without any errors/notices.

Actual result:
--------------
The structure of the email is printed with the notice:

Notice: Uninitialized string offset:  0 in /usr/share/php/Mail/mimeDecode.php on line 468</pre>]]></content:encoded>
      <description><![CDATA[<pre>Mail_mimeDecode Bug
Reported by luke.richards@...
2006-03-29T04:00:04+00:00
PHP: 4.3.11 OS: Linux Package Version: 1.3.1

Description:
------------
468c468
&lt;                     if (is_array($param_value) AND $param_value[0] == '&quot;') {
---
&gt;                     if ($param_value[0] == '&quot;') {



Test script:
---------------
&lt;?php

    require_once(&quot;Mail/mimeDecode.php&quot;);
    
    // this is an email we received
    $string = file_get_contents(&quot;http://www.emailcenteruk.com/pear_report/example_email.eml&quot;);
    
    $params = array();
    $params['include_bodies'] = true;
    $params['decode_bodies']  = true;
    $params['decode_headers'] = true;
    
    $parser = new Mail_mimeDecode($string);
    $structure = $parser-&gt;decode($params);

    print_r($structure);
?&gt;

Expected result:
----------------
The structure of the email is printed without any errors/notices.

Actual result:
--------------
The structure of the email is printed with the notice:

Notice: Uninitialized string offset:  0 in /usr/share/php/Mail/mimeDecode.php on line 468</pre>]]></description>
      <dc:date>2008-01-22T04:17:31+00:00</dc:date>
      <dc:creator>luke &amp;#x64;&amp;#111;&amp;#x74; richards &amp;#x61;&amp;#116; emailcenteruk &amp;#x64;&amp;#111;&amp;#x74; com</dc:creator>
      <dc:subject>Mail_mimeDecode Bug</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/7083">
      <title>Mail_mimeDecode: Bug 7083 [Open] Mail_mimeDecode: Q-printable from TB 1.5 fails to decode</title>
      <link>http://pear.php.net/bugs/7083</link>
      <content:encoded><![CDATA[<pre>Mail_mimeDecode Bug
Reported by joho@...
2006-03-09T16:40:45+00:00
PHP: Irrelevant OS: Linux Package Version: 1.3.1

Description:
------------
As far as I can see, there's nothing unclear about the message header nor the message's contents or encoding. Or is it barfing because there's no 7bit/8bit indicator?

Test script:
---------------
This is the code:

   $input = '';
    $fp = fopen(&quot;php://stdin&quot;, &quot;r&quot;);
    while (!feof ($fp))
        {
        $input .= fgets ($fp, 1024);
        }
    $xo = new Mail_mimeDecode ($input);
    $xa = array ();
    $xa ['include_bodies'] = TRUE;
    $xa ['decode_bodies'] = TRUE;
    $xa ['decode_headers'] = TRUE;
    $xp = $xo-&gt;decode ($xa);

This is the mail:

Date: Thu, 09 Mar 2006 22:18:13 +0100
From: Joaquim Homrighausen &lt;joho@foo.doo&gt;
User-Agent: Thunderbird 1.5 (X11/20051201)
MIME-Version: 1.0
To:  joho@foo.doo
Subject: Detta =?ISO-8859-1?Q?=E4r_en_test=2C_som_vi_skall_te?=
 =?ISO-8859-1?Q?sta?=
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable

Och h=E4r =E4r mailet :-)


Expected result:
----------------
Subject: Detta Ã¤r en test, som vi skall testa

Och hÃ¤r Ã¤r mailet :-)

Actual result:
--------------
Subject: Detta ,r en test, som vi skall testa

Och h,r ,r mailet :-)</pre>]]></content:encoded>
      <description><![CDATA[<pre>Mail_mimeDecode Bug
Reported by joho@...
2006-03-09T16:40:45+00:00
PHP: Irrelevant OS: Linux Package Version: 1.3.1

Description:
------------
As far as I can see, there's nothing unclear about the message header nor the message's contents or encoding. Or is it barfing because there's no 7bit/8bit indicator?

Test script:
---------------
This is the code:

   $input = '';
    $fp = fopen(&quot;php://stdin&quot;, &quot;r&quot;);
    while (!feof ($fp))
        {
        $input .= fgets ($fp, 1024);
        }
    $xo = new Mail_mimeDecode ($input);
    $xa = array ();
    $xa ['include_bodies'] = TRUE;
    $xa ['decode_bodies'] = TRUE;
    $xa ['decode_headers'] = TRUE;
    $xp = $xo-&gt;decode ($xa);

This is the mail:

Date: Thu, 09 Mar 2006 22:18:13 +0100
From: Joaquim Homrighausen &lt;joho@foo.doo&gt;
User-Agent: Thunderbird 1.5 (X11/20051201)
MIME-Version: 1.0
To:  joho@foo.doo
Subject: Detta =?ISO-8859-1?Q?=E4r_en_test=2C_som_vi_skall_te?=
 =?ISO-8859-1?Q?sta?=
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable

Och h=E4r =E4r mailet :-)


Expected result:
----------------
Subject: Detta Ã¤r en test, som vi skall testa

Och hÃ¤r Ã¤r mailet :-)

Actual result:
--------------
Subject: Detta ,r en test, som vi skall testa

Och h,r ,r mailet :-)</pre>]]></description>
      <dc:date>2006-04-27T09:35:29+00:00</dc:date>
      <dc:creator>joho &amp;#x61;&amp;#116; webbplatsen &amp;#x64;&amp;#111;&amp;#x74; se</dc:creator>
      <dc:subject>Mail_mimeDecode Bug</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/7065">
      <title>Mail_mimeDecode: Bug 7065 [Open] Mail_mimeDecode: Problem with long subjects</title>
      <link>http://pear.php.net/bugs/7065</link>
      <content:encoded><![CDATA[<pre>Mail_mimeDecode Bug
Reported by julien.laurent@...
2006-03-08T17:55:18+00:00
PHP: 4.3.10 OS: Win32 + Linux Package Version: 1.3.1

Description:
------------
When the mail subject is long and coded on more 2 lines in utf-8 (see example below), function '_decodeHeader' does not remove all white space between encoded-words.

Test script:
---------------
Subject: =?utf-8?Q?Magnifique_bastide_au_pied_de_la?=
	=?utf-8?Q?_Sainte_Victoire_=C3=A0_Aix-en-Proven?=
	=?utf-8?Q?ce?=

Expected result:
----------------
Magnifique bastide au pied de la Sainte Victoire Ã  Aix-en-Provence

Actual result:
--------------
Magnifique bastide au pied de la Sainte Victoire Ã  Aix-en-Proven ce</pre>]]></content:encoded>
      <description><![CDATA[<pre>Mail_mimeDecode Bug
Reported by julien.laurent@...
2006-03-08T17:55:18+00:00
PHP: 4.3.10 OS: Win32 + Linux Package Version: 1.3.1

Description:
------------
When the mail subject is long and coded on more 2 lines in utf-8 (see example below), function '_decodeHeader' does not remove all white space between encoded-words.

Test script:
---------------
Subject: =?utf-8?Q?Magnifique_bastide_au_pied_de_la?=
	=?utf-8?Q?_Sainte_Victoire_=C3=A0_Aix-en-Proven?=
	=?utf-8?Q?ce?=

Expected result:
----------------
Magnifique bastide au pied de la Sainte Victoire Ã  Aix-en-Provence

Actual result:
--------------
Magnifique bastide au pied de la Sainte Victoire Ã  Aix-en-Proven ce</pre>]]></description>
      <dc:date>2006-04-27T09:35:15+00:00</dc:date>
      <dc:creator>julien &amp;#x64;&amp;#111;&amp;#x74; laurent &amp;#x61;&amp;#116; sypro &amp;#x64;&amp;#111;&amp;#x74; net</dc:creator>
      <dc:subject>Mail_mimeDecode Bug</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/6748">
      <title>Mail_mimeDecode: Bug 6748 [Open] Mail_mimeDecode: _parseHeaderValue fails on filename with quote</title>
      <link>http://pear.php.net/bugs/6748</link>
      <content:encoded><![CDATA[<pre>Mail_mimeDecode Bug
Reported by olaf.wodrich@...
2006-02-10T13:50:34+00:00
PHP: Irrelevant OS:  Package Version: 1.3.1

Description:
------------
If the filename of an attachment contains (single) quote(s) the parsing of that header part fails under certain conditions (not always). The method returns that part unchanged (fallback). Long filenames that are split into several parts seem to be a condition when this happens.

Test script:
---------------
Content-Type: audio/mpeg;
 name*0=&quot;Grandmaster Flash and the Furious Five - It's Nasty (Genius of L&quot;;
 name*1=&quot;ove).mp3&quot;</pre>]]></content:encoded>
      <description><![CDATA[<pre>Mail_mimeDecode Bug
Reported by olaf.wodrich@...
2006-02-10T13:50:34+00:00
PHP: Irrelevant OS:  Package Version: 1.3.1

Description:
------------
If the filename of an attachment contains (single) quote(s) the parsing of that header part fails under certain conditions (not always). The method returns that part unchanged (fallback). Long filenames that are split into several parts seem to be a condition when this happens.

Test script:
---------------
Content-Type: audio/mpeg;
 name*0=&quot;Grandmaster Flash and the Furious Five - It's Nasty (Genius of L&quot;;
 name*1=&quot;ove).mp3&quot;</pre>]]></description>
      <dc:date>2006-04-27T09:35:11+00:00</dc:date>
      <dc:creator>olaf &amp;#x64;&amp;#111;&amp;#x74; wodrich &amp;#x61;&amp;#116; entrics &amp;#x64;&amp;#111;&amp;#x74; de</dc:creator>
      <dc:subject>Mail_mimeDecode Bug</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/6495">
      <title>Mail_mimeDecode: Bug 6495 [Open] Mail_mimeDecode: Some parts of body not included in decode object</title>
      <link>http://pear.php.net/bugs/6495</link>
      <content:encoded><![CDATA[<pre>Mail_mimeDecode Bug
Reported by alex@...
2006-01-15T11:41:20+00:00
PHP: Irrelevant OS: Linux Package Version: 

Description:
------------
Some email message don't have boundary string at the end of messages. In this case last part of body will missed. I offer follow variant:
    function _boundarySplit($input, $boundary) {
        $parts = array();
        $bs_possible = substr($boundary, 2, -2);
        $bs_check = '\&quot;' . $bs_possible . '\&quot;';
        if ($boundary == $bs_check) {
            $boundary = $bs_possible;
        }
        $tmp = explode('--' . $boundary, $input);
        // CHANGES START -- check all elements of array
        // and add to parts only not empty
        for ($i = 1; $i &lt; count($tmp); $i++) {
        	if (trim($tmp[$i])) {
            	$parts[] = $tmp[$i];
            }
        }
        // CHANGES END
        return $parts;
    }</pre>]]></content:encoded>
      <description><![CDATA[<pre>Mail_mimeDecode Bug
Reported by alex@...
2006-01-15T11:41:20+00:00
PHP: Irrelevant OS: Linux Package Version: 

Description:
------------
Some email message don't have boundary string at the end of messages. In this case last part of body will missed. I offer follow variant:
    function _boundarySplit($input, $boundary) {
        $parts = array();
        $bs_possible = substr($boundary, 2, -2);
        $bs_check = '\&quot;' . $bs_possible . '\&quot;';
        if ($boundary == $bs_check) {
            $boundary = $bs_possible;
        }
        $tmp = explode('--' . $boundary, $input);
        // CHANGES START -- check all elements of array
        // and add to parts only not empty
        for ($i = 1; $i &lt; count($tmp); $i++) {
        	if (trim($tmp[$i])) {
            	$parts[] = $tmp[$i];
            }
        }
        // CHANGES END
        return $parts;
    }</pre>]]></description>
      <dc:date>2006-04-27T09:35:08+00:00</dc:date>
      <dc:creator>alex &amp;#x61;&amp;#116; wdg &amp;#x64;&amp;#111;&amp;#x74; com &amp;#x64;&amp;#111;&amp;#x74; ua</dc:creator>
      <dc:subject>Mail_mimeDecode Bug</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/5730">
      <title>Mail_mimeDecode: Bug 5730 [Open] Mail_MimeDecode: Incorrect Mail decode - no body</title>
      <link>http://pear.php.net/bugs/5730</link>
      <content:encoded><![CDATA[<pre>Mail_mimeDecode Bug
Reported by nicolas@...
2005-10-20T04:44:54+00:00
PHP: 5.0.5 OS:  Package Version: 

Description:
------------
Incorrect Mail Decode.

Decoder unable to give back the body of a multipart mail message when there is only one part.

Test script:
---------------
$thisMessage=file_get_contents('http://www.isaveurs.com/tmp/tst.html');
$params['include_bodies'] = TRUE;
$params['decode_bodies']  = TRUE;
$params['decode_headers'] = TRUE;
$decoder = new Mail_mimeDecode($thisMessage);
$messStruct = $decoder-&gt;decode($params);
// messStruct will have no parts[].

?? Patch ??
line 503 in mimeDecode::_boundarySplit
 for ($i = 1; $i &lt; count($tmp)-1 ; $i++) {
should be
 for ($i = 1; $i &lt; count($tmp) ; $i++) {

Clearly, it works with this code in this special case - haven't tested it with other mails samples to see any side effect.

Expected result:
----------------
$messStruct should have one parts[].





Actual result:
--------------
messStruct will has no parts[].</pre>]]></content:encoded>
      <description><![CDATA[<pre>Mail_mimeDecode Bug
Reported by nicolas@...
2005-10-20T04:44:54+00:00
PHP: 5.0.5 OS:  Package Version: 

Description:
------------
Incorrect Mail Decode.

Decoder unable to give back the body of a multipart mail message when there is only one part.

Test script:
---------------
$thisMessage=file_get_contents('http://www.isaveurs.com/tmp/tst.html');
$params['include_bodies'] = TRUE;
$params['decode_bodies']  = TRUE;
$params['decode_headers'] = TRUE;
$decoder = new Mail_mimeDecode($thisMessage);
$messStruct = $decoder-&gt;decode($params);
// messStruct will have no parts[].

?? Patch ??
line 503 in mimeDecode::_boundarySplit
 for ($i = 1; $i &lt; count($tmp)-1 ; $i++) {
should be
 for ($i = 1; $i &lt; count($tmp) ; $i++) {

Clearly, it works with this code in this special case - haven't tested it with other mails samples to see any side effect.

Expected result:
----------------
$messStruct should have one parts[].





Actual result:
--------------
messStruct will has no parts[].</pre>]]></description>
      <dc:date>2006-04-27T09:34:56+00:00</dc:date>
      <dc:creator>nicolas &amp;#x61;&amp;#116; isaveurs &amp;#x64;&amp;#111;&amp;#x74; com</dc:creator>
      <dc:subject>Mail_mimeDecode Bug</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/4962">
      <title>Mail_mimeDecode: Bug 4962 [Open] Mail_MimeDecode: decode impossible with thunderbird</title>
      <link>http://pear.php.net/bugs/4962</link>
      <content:encoded><![CDATA[<pre>Mail_mimeDecode Bug
Reported by rouxo@...
2005-08-01T11:30:19+00:00
PHP: 4.3.4 OS: linux Package Version: 

Description:
------------
When i try to decode a email without files attached from thunderbird it fails

when i try to decode an email without files from outlook express it is ok

example of email fails :

mail_mimedecode Object ( [_debug] =&gt; [_default_error_mode] =&gt; [_default_error_options] =&gt; [_default_error_handler] =&gt; [_error_class] =&gt; PEAR_Error [_expected_errors] =&gt; Array ( ) [_input] =&gt; Received: by boccob (mbox testfax) (with Cubic Circle's cucipop (v1.31 1998/05/13) Mon Aug 1 18:27:08 2005) X-From_: Olivier.Roux@netultra.net Mon Aug 1 18:27:04 2005 Return-Path: Received: from myhrisse.netultra.net (myhrisse.netultra.net [213.186.62.200]) by boccob.netultra.net (8.12.10/8.12.5) with ESMTP id j71GR4K5004179 for &lt;0164034849@faxpro.Fr&gt;; Mon, 1 Aug 2005 18:27:04 +0200 Received: from [10.0.0.2] (ppp-156.pool3.dsl.netultra.net [217.66.124.156]) by myhrisse.netultra.net (8.12.10/8.12.10) with ESMTP id j71GR3e7008322 for &lt;0164034849@faxpro.Fr&gt;; Mon, 1 Aug 2005 18:27:03 +0200 Message-ID: &lt;42EE4D64.7050003@netultra.net&gt; Date: Mon, 01 Aug 2005 18:27:16 +0200 From: Olivier Roux User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: fr, en MIME-Version: 1.0 To: 0164034849@faxpro.Fr Subject: test Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit this is a test [_header] =&gt; [_body] =&gt; [_error] =&gt; Could not split header and body [_include_bodies] =&gt; 1 [_decode_bodies] =&gt; [_decode_headers] =&gt; )

Test script:
---------------
$input=$pop3-&gt;getRawHeaders($nummessage).chr(13).$pop3-&gt;getBody($nummess
age);
        $decoder = new Mail_mimeDecode($input);

        echo &quot;Decoder :&lt;br&gt;&quot;;
        print_r($decoder);
        echo &quot;fin decoder : &lt;br&gt;&quot;;
        $structure = $decoder-&gt;decode($params);</pre>]]></content:encoded>
      <description><![CDATA[<pre>Mail_mimeDecode Bug
Reported by rouxo@...
2005-08-01T11:30:19+00:00
PHP: 4.3.4 OS: linux Package Version: 

Description:
------------
When i try to decode a email without files attached from thunderbird it fails

when i try to decode an email without files from outlook express it is ok

example of email fails :

mail_mimedecode Object ( [_debug] =&gt; [_default_error_mode] =&gt; [_default_error_options] =&gt; [_default_error_handler] =&gt; [_error_class] =&gt; PEAR_Error [_expected_errors] =&gt; Array ( ) [_input] =&gt; Received: by boccob (mbox testfax) (with Cubic Circle's cucipop (v1.31 1998/05/13) Mon Aug 1 18:27:08 2005) X-From_: Olivier.Roux@netultra.net Mon Aug 1 18:27:04 2005 Return-Path: Received: from myhrisse.netultra.net (myhrisse.netultra.net [213.186.62.200]) by boccob.netultra.net (8.12.10/8.12.5) with ESMTP id j71GR4K5004179 for &lt;0164034849@faxpro.Fr&gt;; Mon, 1 Aug 2005 18:27:04 +0200 Received: from [10.0.0.2] (ppp-156.pool3.dsl.netultra.net [217.66.124.156]) by myhrisse.netultra.net (8.12.10/8.12.10) with ESMTP id j71GR3e7008322 for &lt;0164034849@faxpro.Fr&gt;; Mon, 1 Aug 2005 18:27:03 +0200 Message-ID: &lt;42EE4D64.7050003@netultra.net&gt; Date: Mon, 01 Aug 2005 18:27:16 +0200 From: Olivier Roux User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: fr, en MIME-Version: 1.0 To: 0164034849@faxpro.Fr Subject: test Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit this is a test [_header] =&gt; [_body] =&gt; [_error] =&gt; Could not split header and body [_include_bodies] =&gt; 1 [_decode_bodies] =&gt; [_decode_headers] =&gt; )

Test script:
---------------
$input=$pop3-&gt;getRawHeaders($nummessage).chr(13).$pop3-&gt;getBody($nummess
age);
        $decoder = new Mail_mimeDecode($input);

        echo &quot;Decoder :&lt;br&gt;&quot;;
        print_r($decoder);
        echo &quot;fin decoder : &lt;br&gt;&quot;;
        $structure = $decoder-&gt;decode($params);</pre>]]></description>
      <dc:date>2006-04-27T09:34:45+00:00</dc:date>
      <dc:creator>rouxo &amp;#x61;&amp;#116; netultra &amp;#x64;&amp;#111;&amp;#x74; net</dc:creator>
      <dc:subject>Mail_mimeDecode Bug</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/4739">
      <title>Mail_mimeDecode: Bug 4739 [Open] Mail_MimeDecode: d_parameters['filename'] missing</title>
      <link>http://pear.php.net/bugs/4739</link>
      <content:encoded><![CDATA[<pre>Mail_mimeDecode Bug
Reported by cm@...
2005-07-04T09:56:40+00:00
PHP: 4.3.10 OS: Debian Sarge Package Version: 

Description:
------------
Sometimes the d_parameters['filename'] or ['name'] is missing with the attachment. this happens with utf8 encoded filenames(mostly from M$ clients it seems). without filename im unable to save the file. below is the samplecode i use to save the attachments. i have a testsuite with about 900 mails and this problem exists with more than 10% of these. 

i've tried this with and without utf8_decode, but the variables are always empty.

Reproduce code:
---------------
       if (isset($part-&gt;disposition) and ($part-&gt;disposition=='attachment')) {
       printf(utf8_decode($part-&gt;ctype_parameters['name']).&quot;\n&quot;);
        printf(utf8_decode($part-&gt;ctype_parameters['filename']).&quot;\n&quot;);
       $attachmentfile = fopen($datedir.&quot;/&quot;.utf8_decode($part-&gt;ctype_parameters['name']), 'w');
       fwrite($attachmentfile, $part-&gt;body);
       fclose($attachmentfile);
            
    }       


Expected result:
----------------
this is the print_r($part):

stdClass Object
(
    [headers] =&gt; Array
        (
            [content-type] =&gt; application/PDF
            [content-disposition] =&gt; attachment; filename=&quot;AuftragsbestÃÂ¤tigung_SO_1312338.pdf&quot;
            [content-transfer-encoding] =&gt; base64
        )

    [ctype_primary] =&gt; application
    [ctype_secondary] =&gt; PDF
    [disposition] =&gt; attachment
    [d_parameters] =&gt; Array
        (
            [filename] =&gt; AuftragsbestÃÂ¤tigung_SO_1312338.pdf
        )

    [body] =&gt; %PDF-1.4M%Ã¢Ã£ÃÃM


so the filename parameter is there.



Actual result:
--------------
but when i use 
printf($part-&gt;ctype_parameters['filename'].&quot;\n&quot;);

this variable is empty.</pre>]]></content:encoded>
      <description><![CDATA[<pre>Mail_mimeDecode Bug
Reported by cm@...
2005-07-04T09:56:40+00:00
PHP: 4.3.10 OS: Debian Sarge Package Version: 

Description:
------------
Sometimes the d_parameters['filename'] or ['name'] is missing with the attachment. this happens with utf8 encoded filenames(mostly from M$ clients it seems). without filename im unable to save the file. below is the samplecode i use to save the attachments. i have a testsuite with about 900 mails and this problem exists with more than 10% of these. 

i've tried this with and without utf8_decode, but the variables are always empty.

Reproduce code:
---------------
       if (isset($part-&gt;disposition) and ($part-&gt;disposition=='attachment')) {
       printf(utf8_decode($part-&gt;ctype_parameters['name']).&quot;\n&quot;);
        printf(utf8_decode($part-&gt;ctype_parameters['filename']).&quot;\n&quot;);
       $attachmentfile = fopen($datedir.&quot;/&quot;.utf8_decode($part-&gt;ctype_parameters['name']), 'w');
       fwrite($attachmentfile, $part-&gt;body);
       fclose($attachmentfile);
            
    }       


Expected result:
----------------
this is the print_r($part):

stdClass Object
(
    [headers] =&gt; Array
        (
            [content-type] =&gt; application/PDF
            [content-disposition] =&gt; attachment; filename=&quot;AuftragsbestÃÂ¤tigung_SO_1312338.pdf&quot;
            [content-transfer-encoding] =&gt; base64
        )

    [ctype_primary] =&gt; application
    [ctype_secondary] =&gt; PDF
    [disposition] =&gt; attachment
    [d_parameters] =&gt; Array
        (
            [filename] =&gt; AuftragsbestÃÂ¤tigung_SO_1312338.pdf
        )

    [body] =&gt; %PDF-1.4M%Ã¢Ã£ÃÃM


so the filename parameter is there.



Actual result:
--------------
but when i use 
printf($part-&gt;ctype_parameters['filename'].&quot;\n&quot;);

this variable is empty.</pre>]]></description>
      <dc:date>2006-04-27T09:34:39+00:00</dc:date>
      <dc:creator>cm &amp;#x61;&amp;#116; data-consult &amp;#x64;&amp;#111;&amp;#x74; de</dc:creator>
      <dc:subject>Mail_mimeDecode Bug</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/4585">
      <title>Mail_mimeDecode: Bug 4585 [Analyzed] Mail_MimeDecode: Mime boundary regex not taking simple quotes</title>
      <link>http://pear.php.net/bugs/4585</link>
      <content:encoded><![CDATA[<pre>Mail_mimeDecode Bug
Reported by cyril@...
2005-06-14T01:17:26+00:00
PHP: 4.3.11 OS: Irrelevant Package Version: 

Description:
------------
I have an email containing a simple quote as part of the 
boundary. Here's an abstract:

Received: from smtpauth00.csee.siteprotect.com 
([64.41.126.131] verified)
  by mac.ecomposite.fr (CommuniGate Pro SMTP 4.2.4)
  with ESMTP id 190010 for 
cgodefroy.motdepasse@mobipict.com; Tue, 07 Jun 2005 11:31:48 
+0200
Received: from [10.233.32.33] (unknown [213.223.195.4])
    by smtpauth00.csee.siteprotect.com (Postfix) with ESMTP 
id 2B4AA2BC018
    for &lt;cgodefroy.motdepasse@mobipict.com&gt;; Tue,  7 Jun 
2005 04:30:46 -0500 (CDT)
From: matthew@websan.net
Reply-To: matthew@websan.net
To: cgodefroy.motdepasse@mobipict.com
Subject:
Date: Tue,  7 Jun 2005 11:31:50 +0200
Message-ID: &lt;4fvkKYQlf42G.lSqWYn24@smtp.websan.net&gt;
X-Mailer: EPOC Email Version 2.10
MIME-Version: 1.0
Content-Language: i-default
Content-Type: multipart/mixed;
  boundary=&quot;EPOC32-DJjQs,Tv1+-
mt6_9tZd'vjYGTpL7nKjkm0lM9Wh02x7MrM3j&quot;

*This message was transferred with a trial version of 
CommuniGate(tm) Pro*
This is a MIME Message

--EPOC32-DJjQs,Tv1+-mt6_9tZd'vjYGTpL7nKjkm0lM9Wh02x7MrM3j
Content-Type: text/plain; charset=UTF-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

--EPOC32-DJjQs,Tv1+-mt6_9tZd'vjYGTpL7nKjkm0lM9Wh02x7MrM3j
Content-Type:  application/octet-stream
Content-Disposition: attachment;
    filename=&quot;461M0022.jpg&quot;
Content-Transfer-Encoding: base64

/9j/4QGsRXhpZgAASUkqAAgAAAAKAA4BAgAgAAAAhgAAAA8BAgAOAAAApgAA
ABABAgATAAAAtAAAABIBAwABAAAAAQAAABoBBQABAAAAyAAAABsBBQABAAAA
0AAAACgBAwABAAAAAgAAADIBAgAUAAAA2AAAABMCAwABAAAAAgAAAGmHBAAB
cSR1GR0JzSt1AR+EAZufpUA+U8N2qRm5B7H8qCcsVC9O2MVW2wthhJAA4x9K
aYycluDTvLOWZgcA4HFJjcMp261V7ahZob64BHtTQzBuOuOeD0pTkLls5z0z
Sct06+nWnoNIUnDEk5B6cUjHp1APpQW7E4GO9ISu0AEYJoQdRWAdSCduOc5F
RhfmwrZJpV2rn5uMYpUChsAnJ6EGnsJ6DG2nHpnk5oLHnOPYGnyMoJJ5z1wa
jwpzuOD9Ka13JaDd04HFM5Gcg9etPI3LxnnpjmmkY+YdPrTVgshuC2DwMHmm
tggjcSewFOkBZM5Az0xxTNmNrMwx35qg0P/Z


Reproduce code:
---------------
$params['include_bodies'] = true;
$params['decode_bodies'] = true;
$params['decode_headers'] = true;
$params['input'] = $input;

$structure = Mail_mimeDecode::decode($params);

Irrelevant he?

Expected result:
----------------
Without the simple quote in the boundary header, no error at 
all, the decode works fine and I have all parts of the email 
message.

Actual result:
--------------
I get 'No boundary found for ...' error message.
So I guess I should modify the regex in parseheadervalue() 
unfortunately I cannot read or correct it: it is way too 
complicated for me.</pre>]]></content:encoded>
      <description><![CDATA[<pre>Mail_mimeDecode Bug
Reported by cyril@...
2005-06-14T01:17:26+00:00
PHP: 4.3.11 OS: Irrelevant Package Version: 

Description:
------------
I have an email containing a simple quote as part of the 
boundary. Here's an abstract:

Received: from smtpauth00.csee.siteprotect.com 
([64.41.126.131] verified)
  by mac.ecomposite.fr (CommuniGate Pro SMTP 4.2.4)
  with ESMTP id 190010 for 
cgodefroy.motdepasse@mobipict.com; Tue, 07 Jun 2005 11:31:48 
+0200
Received: from [10.233.32.33] (unknown [213.223.195.4])
    by smtpauth00.csee.siteprotect.com (Postfix) with ESMTP 
id 2B4AA2BC018
    for &lt;cgodefroy.motdepasse@mobipict.com&gt;; Tue,  7 Jun 
2005 04:30:46 -0500 (CDT)
From: matthew@websan.net
Reply-To: matthew@websan.net
To: cgodefroy.motdepasse@mobipict.com
Subject:
Date: Tue,  7 Jun 2005 11:31:50 +0200
Message-ID: &lt;4fvkKYQlf42G.lSqWYn24@smtp.websan.net&gt;
X-Mailer: EPOC Email Version 2.10
MIME-Version: 1.0
Content-Language: i-default
Content-Type: multipart/mixed;
  boundary=&quot;EPOC32-DJjQs,Tv1+-
mt6_9tZd'vjYGTpL7nKjkm0lM9Wh02x7MrM3j&quot;

*This message was transferred with a trial version of 
CommuniGate(tm) Pro*
This is a MIME Message

--EPOC32-DJjQs,Tv1+-mt6_9tZd'vjYGTpL7nKjkm0lM9Wh02x7MrM3j
Content-Type: text/plain; charset=UTF-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

--EPOC32-DJjQs,Tv1+-mt6_9tZd'vjYGTpL7nKjkm0lM9Wh02x7MrM3j
Content-Type:  application/octet-stream
Content-Disposition: attachment;
    filename=&quot;461M0022.jpg&quot;
Content-Transfer-Encoding: base64

/9j/4QGsRXhpZgAASUkqAAgAAAAKAA4BAgAgAAAAhgAAAA8BAgAOAAAApgAA
ABABAgATAAAAtAAAABIBAwABAAAAAQAAABoBBQABAAAAyAAAABsBBQABAAAA
0AAAACgBAwABAAAAAgAAADIBAgAUAAAA2AAAABMCAwABAAAAAgAAAGmHBAAB
cSR1GR0JzSt1AR+EAZufpUA+U8N2qRm5B7H8qCcsVC9O2MVW2wthhJAA4x9K
aYycluDTvLOWZgcA4HFJjcMp261V7ahZob64BHtTQzBuOuOeD0pTkLls5z0z
Sct06+nWnoNIUnDEk5B6cUjHp1APpQW7E4GO9ISu0AEYJoQdRWAdSCduOc5F
RhfmwrZJpV2rn5uMYpUChsAnJ6EGnsJ6DG2nHpnk5oLHnOPYGnyMoJJ5z1wa
jwpzuOD9Ka13JaDd04HFM5Gcg9etPI3LxnnpjmmkY+YdPrTVgshuC2DwMHmm
tggjcSewFOkBZM5Az0xxTNmNrMwx35qg0P/Z


Reproduce code:
---------------
$params['include_bodies'] = true;
$params['decode_bodies'] = true;
$params['decode_headers'] = true;
$params['input'] = $input;

$structure = Mail_mimeDecode::decode($params);

Irrelevant he?

Expected result:
----------------
Without the simple quote in the boundary header, no error at 
all, the decode works fine and I have all parts of the email 
message.

Actual result:
--------------
I get 'No boundary found for ...' error message.
So I guess I should modify the regex in parseheadervalue() 
unfortunately I cannot read or correct it: it is way too 
complicated for me.</pre>]]></description>
      <dc:date>2007-02-12T16:18:49+00:00</dc:date>
      <dc:creator>cyril &amp;#x61;&amp;#116; ecomposite &amp;#x64;&amp;#111;&amp;#x74; fr</dc:creator>
      <dc:subject>Mail_mimeDecode Bug</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/2415">
      <title>Mail_mimeDecode: Bug 2415 [Open] Mail_MimeDecode: No UTF-8 decoding of header</title>
      <link>http://pear.php.net/bugs/2415</link>
      <content:encoded><![CDATA[<pre>Mail_mimeDecode Bug
Reported by urs
2004-09-30T03:31:24+00:00
PHP: 4.3.8 OS: Windows/Linux Package Version: 

Description:
------------
Migrating UTF-8

There is currently a problem with UTF-8 decoding regarding the headers in Mail_MimeDecode. 

Eventually there is a PHP-native &quot;mb_decode_mimeheader&quot; to be independent from mbstring functions.

Reproduce code:
---------------
You can come around it by applying the following patch:

&lt;?php
// http://cvs.php.net/co.php/pear/Mail_Mime/mimeDecode.php?r=1.40
// http://pear.php.net/manual/en/package.mail.mail-mimedecode.example.php

// The following three lines are to add
if(stristr($text, 'utf-8'))
    $text = mb_decode_mimeheader($text);
}
// About line 541
$input = str_replace($encoded, $text, $input);
?&gt;

Expected result:
----------------
Source
$utf8_str = '2. OOS Tagung =?UTF-8?B?ZsO8ciBkaWUgw5ZmZmVudGxpY2hlIFY=';

Expected Result:
2. OOS Tagung fÃ¼r die Ãffentliche V

Actual result:
--------------
2. OOS Tagung fÃÂ¼r die Ãâffentliche V</pre>]]></content:encoded>
      <description><![CDATA[<pre>Mail_mimeDecode Bug
Reported by urs
2004-09-30T03:31:24+00:00
PHP: 4.3.8 OS: Windows/Linux Package Version: 

Description:
------------
Migrating UTF-8

There is currently a problem with UTF-8 decoding regarding the headers in Mail_MimeDecode. 

Eventually there is a PHP-native &quot;mb_decode_mimeheader&quot; to be independent from mbstring functions.

Reproduce code:
---------------
You can come around it by applying the following patch:

&lt;?php
// http://cvs.php.net/co.php/pear/Mail_Mime/mimeDecode.php?r=1.40
// http://pear.php.net/manual/en/package.mail.mail-mimedecode.example.php

// The following three lines are to add
if(stristr($text, 'utf-8'))
    $text = mb_decode_mimeheader($text);
}
// About line 541
$input = str_replace($encoded, $text, $input);
?&gt;

Expected result:
----------------
Source
$utf8_str = '2. OOS Tagung =?UTF-8?B?ZsO8ciBkaWUgw5ZmZmVudGxpY2hlIFY=';

Expected Result:
2. OOS Tagung fÃ¼r die Ãffentliche V

Actual result:
--------------
2. OOS Tagung fÃÂ¼r die Ãâffentliche V</pre>]]></description>
      <dc:date>2006-04-27T09:34:26+00:00</dc:date>
      <dc:creator>urs &amp;#x61;&amp;#116; circle &amp;#x64;&amp;#111;&amp;#x74; ch</dc:creator>
      <dc:subject>Mail_mimeDecode Bug</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/2100">
      <title>Mail_mimeDecode: Feature/Change Request 2100 [Open] Mail_MimeDecode: doesn't decode forwarded MIME messages</title>
      <link>http://pear.php.net/bugs/2100</link>
      <content:encoded><![CDATA[<pre>Mail_mimeDecode Feature/Change Request
Reported by john@...
2004-08-10T00:13:24+00:00
PHP: 4.3.5 OS: Linux Package Version: 

Description:
------------
The latest version 1.2.1 of mimeDecode doesn't correctly decode forwarded mime messages, even if you set the '_decode_headers' option.

I think the problem is around line 300. I made changes as shown in 'reproduce code' which fixed the problem.

Maybe there's reason not to decode forwarded messages... if that's the case maybe it would be better as another option to set when calling 'decode()'.

I made another change as well, to use the built-in 'quoted_printable_decode' if it exists.

Thanks for the great code!

John Pye

(PS if you want to acknowledge me then please use my web address www.curioussymbols.com rather than my email address, coz I've been getting spam following another PEAR listing).

Reproduce code:
---------------
Around line 300---

case 'message/rfc822':
    $obj = &amp;new Mail_mimeDecode($body);
    $return-&gt;parts[] = $obj-&gt;decode(
	array(
		'include_bodies' =&gt; $this-&gt;_include_bodies
		// ADD THE FOLLOWING &lt;&lt;
		,'decode_bodies'=&gt;$this-&gt;_decode_bodies
		// &lt;&lt; END
	)
    );
    unset($obj);
    break;

Around line 570---

function _quotedPrintableDecode($input)
{	
	// ADD THE FOLLOWING &lt;&lt;
	if(function_exists('quoted_printable_decode')){
		return quoted_printable_decode($input);
	}
	// &lt;&lt; END</pre>]]></content:encoded>
      <description><![CDATA[<pre>Mail_mimeDecode Feature/Change Request
Reported by john@...
2004-08-10T00:13:24+00:00
PHP: 4.3.5 OS: Linux Package Version: 

Description:
------------
The latest version 1.2.1 of mimeDecode doesn't correctly decode forwarded mime messages, even if you set the '_decode_headers' option.

I think the problem is around line 300. I made changes as shown in 'reproduce code' which fixed the problem.

Maybe there's reason not to decode forwarded messages... if that's the case maybe it would be better as another option to set when calling 'decode()'.

I made another change as well, to use the built-in 'quoted_printable_decode' if it exists.

Thanks for the great code!

John Pye

(PS if you want to acknowledge me then please use my web address www.curioussymbols.com rather than my email address, coz I've been getting spam following another PEAR listing).

Reproduce code:
---------------
Around line 300---

case 'message/rfc822':
    $obj = &amp;new Mail_mimeDecode($body);
    $return-&gt;parts[] = $obj-&gt;decode(
	array(
		'include_bodies' =&gt; $this-&gt;_include_bodies
		// ADD THE FOLLOWING &lt;&lt;
		,'decode_bodies'=&gt;$this-&gt;_decode_bodies
		// &lt;&lt; END
	)
    );
    unset($obj);
    break;

Around line 570---

function _quotedPrintableDecode($input)
{	
	// ADD THE FOLLOWING &lt;&lt;
	if(function_exists('quoted_printable_decode')){
		return quoted_printable_decode($input);
	}
	// &lt;&lt; END</pre>]]></description>
      <dc:date>2006-04-27T09:32:36+00:00</dc:date>
      <dc:creator>john &amp;#x61;&amp;#116; curioussymbols &amp;#x64;&amp;#111;&amp;#x74; com</dc:creator>
      <dc:subject>Mail_mimeDecode Feature/Change Request</dc:subject>
    </item>
</rdf:RDF>
