<?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/27009" />
      <rdf:li rdf:resource="http://pear.php.net/bug/21215" />
      <rdf:li rdf:resource="http://pear.php.net/bug/21210" />
      <rdf:li rdf:resource="http://pear.php.net/bug/20997" />
      <rdf:li rdf:resource="http://pear.php.net/bug/19961" />

     </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/27009">
      <title>Mail_mimeDecode: Bug 27009 [Open] Apple Mail multipart/signed</title>
      <link>http://pear.php.net/bugs/27009</link>
      <content:encoded><![CDATA[<pre>Mail_mimeDecode Bug
Reported by dlopez
2021-01-27T03:05:49+00:00
PHP: 7.3.19 OS: Debian Linux Package Version: SVN

Description:
------------
I came across an email in the wild composed on Apple Mail 
(2.3608.120.23.2.4) whose Content-Type is multipart/signed and then 
within that is multipart/alternative with text/plain and multipart/mixed 
subparts (and the mixed part contains text/html and inline attachments).  
Headers with simplified boundaries (for easier reading) are at bottom.
 
When I use mimeDecode-&gt;decode() the returned msg_body is the entire 
raw part within it; that is, there's no recursion on all the subparts.  This 
appears to be reported in bug#21215 as well, but it appears unresolved.

Looking at line 324 of mimeDecode.php, I see that multipart/signed is 
handled separately from the other multipart cases below it, such that 
subparts are not decoded.  If I comment out that block it then gets caught 
by line 335 and thus handled like other multipart emails as expected.

Since I'm unfamiliar with signed email standards, I'm unsure why the 
block starting at line 324 is needed at all.  If sig_hdr and sig_body are 
special values to help signature verification against a raw msg_body, then 
maybe those should just be special return values added just for 
multipart/signed without affecting the rest of the expected multipart 
processing.  In that case there would be an 
if(strtolower($content_type['value'])=='multipart/signed'){} around line 
349 to add the sig_hdr and sig_body parameters.

-----

Content-Type: multipart/signed; boundary=&quot;Apple-Mail=_111&quot;; 
protocol=&quot;application/pkcs7-signature&quot;; micalg=sha-256
...
X-Mailer: Apple Mail (2.3608.120.23.2.4)

...

--Apple-Mail=_111
Content-Type: multipart/alternative; boundary=&quot;Apple-Mail=_D67DA570-
BD52-4A36-BBAD-76FAC2A72FF5&quot;

--Apple-Mail=_222
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=us-ascii

...

--Apple-Mail=_222
Content-Type: multipart/mixed; boundary=&quot;Apple-Mail=_56032FB6-5676-
46B2-B9FB-34581A21F699&quot;

--Apple-Mail=_333
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=us-ascii

...

--Apple-Mail=_333
Content-Disposition: inline; filename=Example.pdf
Content-Type: application/pdf; x-unix-mode=0644; name=&quot;Example.pdf&quot;
Content-Transfer-Encoding: base64


--Apple-Mail=_333
Content-Transfer-Encoding: 7bit
Content-Type: text/html; charset=us-ascii


...

--Apple-Mail=_333--
--Apple-Mail=_222--
--Apple-Mail=_111
Content-Disposition: attachment; filename=smime.p7s
Content-Type: application/pkcs7-signature; name=smime.p7s
Content-Transfer-Encoding: base64</pre>]]></content:encoded>
      <description><![CDATA[<pre>Mail_mimeDecode Bug
Reported by dlopez
2021-01-27T03:05:49+00:00
PHP: 7.3.19 OS: Debian Linux Package Version: SVN

Description:
------------
I came across an email in the wild composed on Apple Mail 
(2.3608.120.23.2.4) whose Content-Type is multipart/signed and then 
within that is multipart/alternative with text/plain and multipart/mixed 
subparts (and the mixed part contains text/html and inline attachments).  
Headers with simplified boundaries (for easier reading) are at bottom.
 
When I use mimeDecode-&gt;decode() the returned msg_body is the entire 
raw part within it; that is, there's no recursion on all the subparts.  This 
appears to be reported in bug#21215 as well, but it appears unresolved.

Looking at line 324 of mimeDecode.php, I see that multipart/signed is 
handled separately from the other multipart cases below it, such that 
subparts are not decoded.  If I comment out that block it then gets caught 
by line 335 and thus handled like other multipart emails as expected.

Since I'm unfamiliar with signed email standards, I'm unsure why the 
block starting at line 324 is needed at all.  If sig_hdr and sig_body are 
special values to help signature verification against a raw msg_body, then 
maybe those should just be special return values added just for 
multipart/signed without affecting the rest of the expected multipart 
processing.  In that case there would be an 
if(strtolower($content_type['value'])=='multipart/signed'){} around line 
349 to add the sig_hdr and sig_body parameters.

-----

Content-Type: multipart/signed; boundary=&quot;Apple-Mail=_111&quot;; 
protocol=&quot;application/pkcs7-signature&quot;; micalg=sha-256
...
X-Mailer: Apple Mail (2.3608.120.23.2.4)

...

--Apple-Mail=_111
Content-Type: multipart/alternative; boundary=&quot;Apple-Mail=_D67DA570-
BD52-4A36-BBAD-76FAC2A72FF5&quot;

--Apple-Mail=_222
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=us-ascii

...

--Apple-Mail=_222
Content-Type: multipart/mixed; boundary=&quot;Apple-Mail=_56032FB6-5676-
46B2-B9FB-34581A21F699&quot;

--Apple-Mail=_333
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=us-ascii

...

--Apple-Mail=_333
Content-Disposition: inline; filename=Example.pdf
Content-Type: application/pdf; x-unix-mode=0644; name=&quot;Example.pdf&quot;
Content-Transfer-Encoding: base64


--Apple-Mail=_333
Content-Transfer-Encoding: 7bit
Content-Type: text/html; charset=us-ascii


...

--Apple-Mail=_333--
--Apple-Mail=_222--
--Apple-Mail=_111
Content-Disposition: attachment; filename=smime.p7s
Content-Type: application/pkcs7-signature; name=smime.p7s
Content-Transfer-Encoding: base64</pre>]]></description>
      <dc:date>2021-01-27T03:05:49+00:00</dc:date>
      <dc:creator>pear &amp;#x61;&amp;#116; dlopez &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/21215">
      <title>Mail_mimeDecode: Bug 21215 [Open] &quot;multipart/signed&quot; messages decoding issue</title>
      <link>http://pear.php.net/bugs/21215</link>
      <content:encoded><![CDATA[<pre>Mail_mimeDecode Bug
Reported by sgironella
2017-05-31T13:11:31+00:00
PHP: 5.6.30 OS: FreeBSD 11 Package Version: 1.5.6

Description:
------------
On &quot;multipart/signed&quot; messages, &quot;_decode()&quot; method  doesn't return a parts list but an associative array (&quot;msg_body&quot;, &quot;sig_hdr&quot;, &quot;sig_body&quot;); this lead &quot;getMimeNumbers()&quot; method to an infinite loop as it expects to iterate over a parts list and it doesn't manage those keys.

See the case &quot;case 'multipart/signed': // PGP&quot; at line 324

Actual result:
--------------
[31-May-2017 12:41:33 Europe/Rome] PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 72 bytes) in /webroot/vendor/pear-pear.php.net/Mail_mimeDecode/Mail/mimeDecode.php on line 425
[31-May-2017 12:41:33 Europe/Rome] PHP Stack trace:
[31-May-2017 12:41:33 Europe/Rome] PHP   1. {main}() /webroot/index.php:0
[31-May-2017 12:41:33 Europe/Rome] PHP   2. include_once() /webroot/index.php:291
[31-May-2017 12:41:33 Europe/Rome] PHP   3. rcube_message-&gt;__construct() /webroot/program/steps/mail/show.inc:49
[31-May-2017 12:41:33 Europe/Rome] PHP   4. rcube_dbmail-&gt;get_message() /webroot/program/lib/Roundcube/rcube_message.php:94
[31-May-2017 12:41:33 Europe/Rome] PHP   5. rcube_dbmail-&gt;retrieve_message() /webroot/program/lib/Roundcube/rcube_dbmail.php:1100
[31-May-2017 12:41:33 Europe/Rome] PHP   6. rcube_dbmail-&gt;decode_raw_message() /webroot/program/lib/Roundcube/rcube_dbmail.php:4316
[31-May-2017 12:41:33 Europe/Rome] PHP   7. Mail_mimeDecode-&gt;getMimeNumbers() /webroot/program/lib/Roundcube/rcube_dbmail.php:5425
[31-May-2017 12:41:33 Europe/Rome] PHP   8. Mail_mimeDecode-&gt;getMimeNumbers() /webroot/vendor/pear-pear.php.net/Mail_mimeDecode/Mail/mimeDecode.php:415</pre>]]></content:encoded>
      <description><![CDATA[<pre>Mail_mimeDecode Bug
Reported by sgironella
2017-05-31T13:11:31+00:00
PHP: 5.6.30 OS: FreeBSD 11 Package Version: 1.5.6

Description:
------------
On &quot;multipart/signed&quot; messages, &quot;_decode()&quot; method  doesn't return a parts list but an associative array (&quot;msg_body&quot;, &quot;sig_hdr&quot;, &quot;sig_body&quot;); this lead &quot;getMimeNumbers()&quot; method to an infinite loop as it expects to iterate over a parts list and it doesn't manage those keys.

See the case &quot;case 'multipart/signed': // PGP&quot; at line 324

Actual result:
--------------
[31-May-2017 12:41:33 Europe/Rome] PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 72 bytes) in /webroot/vendor/pear-pear.php.net/Mail_mimeDecode/Mail/mimeDecode.php on line 425
[31-May-2017 12:41:33 Europe/Rome] PHP Stack trace:
[31-May-2017 12:41:33 Europe/Rome] PHP   1. {main}() /webroot/index.php:0
[31-May-2017 12:41:33 Europe/Rome] PHP   2. include_once() /webroot/index.php:291
[31-May-2017 12:41:33 Europe/Rome] PHP   3. rcube_message-&gt;__construct() /webroot/program/steps/mail/show.inc:49
[31-May-2017 12:41:33 Europe/Rome] PHP   4. rcube_dbmail-&gt;get_message() /webroot/program/lib/Roundcube/rcube_message.php:94
[31-May-2017 12:41:33 Europe/Rome] PHP   5. rcube_dbmail-&gt;retrieve_message() /webroot/program/lib/Roundcube/rcube_dbmail.php:1100
[31-May-2017 12:41:33 Europe/Rome] PHP   6. rcube_dbmail-&gt;decode_raw_message() /webroot/program/lib/Roundcube/rcube_dbmail.php:4316
[31-May-2017 12:41:33 Europe/Rome] PHP   7. Mail_mimeDecode-&gt;getMimeNumbers() /webroot/program/lib/Roundcube/rcube_dbmail.php:5425
[31-May-2017 12:41:33 Europe/Rome] PHP   8. Mail_mimeDecode-&gt;getMimeNumbers() /webroot/vendor/pear-pear.php.net/Mail_mimeDecode/Mail/mimeDecode.php:415</pre>]]></description>
      <dc:date>2017-06-01T07:06:48+00:00</dc:date>
      <dc:creator>sgironella &amp;#x61;&amp;#116; schema31 &amp;#x64;&amp;#111;&amp;#x74; it</dc:creator>
      <dc:subject>Mail_mimeDecode Bug</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/21210">
      <title>Mail_mimeDecode: Feature/Change Request 21210 [Assigned] please setup packagist for this repo</title>
      <link>http://pear.php.net/bugs/21210</link>
      <content:encoded><![CDATA[<pre>Mail_mimeDecode Feature/Change Request
Reported by glen
2017-05-11T18:55:33+00:00
PHP: Irrelevant OS:  Package Version: 1.5.6

Description:
------------
please convert this repo to git (github)
and setup packagist integration

here's problem i'm suffering:
https://github.com/eventum/eventum/pull/256#issuecomment-
300879398

and i think it's just easier to fix if the package is available in 
packagist</pre>]]></content:encoded>
      <description><![CDATA[<pre>Mail_mimeDecode Feature/Change Request
Reported by glen
2017-05-11T18:55:33+00:00
PHP: Irrelevant OS:  Package Version: 1.5.6

Description:
------------
please convert this repo to git (github)
and setup packagist integration

here's problem i'm suffering:
https://github.com/eventum/eventum/pull/256#issuecomment-
300879398

and i think it's just easier to fix if the package is available in 
packagist</pre>]]></description>
      <dc:date>2017-05-12T03:25:26+00:00</dc:date>
      <dc:creator>glen &amp;#x61;&amp;#116; pld-linux &amp;#x64;&amp;#111;&amp;#x74; org</dc:creator>
      <dc:subject>Mail_mimeDecode Feature/Change Request</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/20997">
      <title>Mail_mimeDecode: Bug 20997 [Verified] Improperly Parsing from Header</title>
      <link>http://pear.php.net/bugs/20997</link>
      <content:encoded><![CDATA[<pre>Mail_mimeDecode Bug
Reported by postletariat
2015-12-13T17:56:35+00:00
PHP: 5.5.30 OS: Linux Package Version: 1.5.5

Description:
------------
It seems as though when I attempt to decode mail from GMail, the from 
header is not becoming properly parsed.

Test script:
---------------
$decoder = new Mail_mimeDecode(stream_get_contents(STDIN));
$structure = $decoder-&gt;decode($params);
echo json_encode($structure);

Expected result:
----------------
I would expect something such as the following (excerpt, presented in 
JSON):

{&quot;headers&quot;:{&quot;from&quot;: &quot;emailaddress@gmail.com sun dec 13 10:46:49 
2015&quot;}}

Actual result:
--------------
Instead, I get something like the following (excerpt, presented in JSON):

{&quot;headers&quot;:{&quot;from emailaddress@gmail.com sun dec 13 10&quot;:&quot;46:49 
2015&quot;}}</pre>]]></content:encoded>
      <description><![CDATA[<pre>Mail_mimeDecode Bug
Reported by postletariat
2015-12-13T17:56:35+00:00
PHP: 5.5.30 OS: Linux Package Version: 1.5.5

Description:
------------
It seems as though when I attempt to decode mail from GMail, the from 
header is not becoming properly parsed.

Test script:
---------------
$decoder = new Mail_mimeDecode(stream_get_contents(STDIN));
$structure = $decoder-&gt;decode($params);
echo json_encode($structure);

Expected result:
----------------
I would expect something such as the following (excerpt, presented in 
JSON):

{&quot;headers&quot;:{&quot;from&quot;: &quot;emailaddress@gmail.com sun dec 13 10:46:49 
2015&quot;}}

Actual result:
--------------
Instead, I get something like the following (excerpt, presented in JSON):

{&quot;headers&quot;:{&quot;from emailaddress@gmail.com sun dec 13 10&quot;:&quot;46:49 
2015&quot;}}</pre>]]></description>
      <dc:date>2015-12-21T07:11:14+00:00</dc:date>
      <dc:creator>laudedfavor &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/19961">
      <title>Mail_mimeDecode: Feature/Change Request 19961 [Open] Failure to parse [file]name*1*=utf-8''URL; [file]name*2*=URL</title>
      <link>http://pear.php.net/bugs/19961</link>
      <content:encoded><![CDATA[<pre>Mail_mimeDecode Feature/Change Request
Reported by randalla
2013-05-29T00:33:18+00:00
PHP: 5.3.23 OS: Linux Package Version: 1.5.5

Description:
------------
This is related to #9616. I'm receiving e-mails from iCloud 
that contain long names, but they are in the format of: 
[file]name*1*=utf-8''%20%20%20%20; 
[file]name*2*=%20%20%20%20%20

Here's some relevant information:

# print_r( $part-&gt;ctype_parameters );
Array
(
    [name*1*] =&gt; utf-
8%48%6F%75%73%65%20%49%6E%73%75%72%61
    [name*2*] =&gt; %6E%63%65%2E%70%64%66
)

# print_r( $part-&gt;headers );
Array
(
	[content-id] =&gt; &lt;35b9249a-1162-4ba3-ab6f-
1518661e1b61@icloud.com&gt;
	[content-type] =&gt; application/pdf; name*1*=utf-
8''%48%6F%75%73%65%20%49%6E%73%75%72%61; 
name*2*=%6E%63%65%2E%70%64%66
	[content-transfer-encoding] =&gt; base64
	[content-disposition] =&gt; attachment; filename*1*=utf-
8''%48%6F%75%73%65%20%49%6E%73%75%72%61; 
filename*2*=%6E%63%65%2E%70%64%66
)

Not sure if it's necessary, but here's some sanitized headers:

From somebody@me.com  Sun May 26 08:41:34 2013
Return-Path: &lt;nobody@me.com&gt;
X-Original-To: myaddress@here.com
Delivered-To: myaddress@here.com
Received: 
Received: 
X-Server-Uuid: 
Received: 
X-Proofpoint-Virus-Version: 
X-Proofpoint-Spam-Details: 
MIME-Version: 1.0
Received: 
To: myaddress@here.com
From: &quot;Somebody&quot; &lt;somebody@me.com&gt;
Subject: Their Subject Line #12345
Date: Sun, 26 May 2013 15:39:54 +0000 (GMT)
X-Mailer: iCloud Mail (1Q)
X-Originating-IP: 
Message-ID: &lt;9978818f-2c21-4e00-8f0c-
094d6ec1c0e8@me.com&gt;
X-TMWD-Spam-Summary: 
X-MMS-Spam-Filter-ID: 
X-WSS-ID: 
Content-Type: multipart/alternative;
 boundary=&quot;Boundary_(ID_ZcR2Vul4mq27B0g0wvFLMg)&quot;

[snipped]

--Boundary_(ID_AcW2oBwQSJ6m0TXXzf7xzw)
Content-ID: &lt;35b9249a-1162-4ba3-ab6f-
1518661e1b61@icloud.com&gt;
Content-Type: application/pdf;
 name*1*=utf-
8''%48%6F%75%73%65%20%49%6E%73%75%72%61;
 name*2*=%6E%63%65%2E%70%64%66
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
 filename*1*=utf-
8''%48%6F%75%73%65%20%49%6E%73%75%72%61;
 filename*2*=%6E%63%65%2E%70%64%66

I am running on Gentoo Linux. The PEAR versions are as 
follows:

dev-php/PEAR-Mail 1.2.0
dev-php/PEAR-Mail_Mime 1.8.7
dev-php/PEAR-Mail_mimeDecode 1.5.5

Test script:
---------------
&lt;?php
/* simple script to work around the issue */
$mime = &quot;attachment; filename*1*=utf-8''%48%6F%75%73%65%20%49%6E%73%75%72%61; filename*2*=%6E%63%65%2E%70%64%66&quot;;
var_dump(
	preg_match_all(
		'/(?&lt;=filename\*\d\*=)[^;]+(?=;|$)/',
		$mime,
		$matches ),
	urldecode( implode( '', $matches[0] ) )
);
?&gt;

Expected result:
----------------
# print_r( $part-&gt;ctype_parameters );
Array
(
    [name] =&gt; House Insurance.pdf
)

# print_r( $part-&gt;headers );
Array
(
	[content-id] =&gt; &lt;35b9249a-1162-4ba3-ab6f-
1518661e1b61@icloud.com&gt;
	[content-type] =&gt; application/pdf; name=House 
Insurance.pdf
	[content-transfer-encoding] =&gt; base64
	[content-disposition] =&gt; attachment; filename=House 
Insurance.pdf
)


Actual result:
--------------
# print_r( $part-&gt;ctype_parameters );
Array
(
    [name*1*] =&gt; utf-
8%48%6F%75%73%65%20%49%6E%73%75%72%61
    [name*2*] =&gt; %6E%63%65%2E%70%64%66
)

# print_r( $part-&gt;headers );
Array
(
	[content-id] =&gt; &lt;35b9249a-1162-4ba3-ab6f-
1518661e1b61@icloud.com&gt;
	[content-type] =&gt; application/pdf; name*1*=utf-
8''%48%6F%75%73%65%20%49%6E%73%75%72%61; 
name*2*=%6E%63%65%2E%70%64%66
	[content-transfer-encoding] =&gt; base64
	[content-disposition] =&gt; attachment; filename*1*=utf-
8''%48%6F%75%73%65%20%49%6E%73%75%72%61; 
filename*2*=%6E%63%65%2E%70%64%66
)</pre>]]></content:encoded>
      <description><![CDATA[<pre>Mail_mimeDecode Feature/Change Request
Reported by randalla
2013-05-29T00:33:18+00:00
PHP: 5.3.23 OS: Linux Package Version: 1.5.5

Description:
------------
This is related to #9616. I'm receiving e-mails from iCloud 
that contain long names, but they are in the format of: 
[file]name*1*=utf-8''%20%20%20%20; 
[file]name*2*=%20%20%20%20%20

Here's some relevant information:

# print_r( $part-&gt;ctype_parameters );
Array
(
    [name*1*] =&gt; utf-
8%48%6F%75%73%65%20%49%6E%73%75%72%61
    [name*2*] =&gt; %6E%63%65%2E%70%64%66
)

# print_r( $part-&gt;headers );
Array
(
	[content-id] =&gt; &lt;35b9249a-1162-4ba3-ab6f-
1518661e1b61@icloud.com&gt;
	[content-type] =&gt; application/pdf; name*1*=utf-
8''%48%6F%75%73%65%20%49%6E%73%75%72%61; 
name*2*=%6E%63%65%2E%70%64%66
	[content-transfer-encoding] =&gt; base64
	[content-disposition] =&gt; attachment; filename*1*=utf-
8''%48%6F%75%73%65%20%49%6E%73%75%72%61; 
filename*2*=%6E%63%65%2E%70%64%66
)

Not sure if it's necessary, but here's some sanitized headers:

From somebody@me.com  Sun May 26 08:41:34 2013
Return-Path: &lt;nobody@me.com&gt;
X-Original-To: myaddress@here.com
Delivered-To: myaddress@here.com
Received: 
Received: 
X-Server-Uuid: 
Received: 
X-Proofpoint-Virus-Version: 
X-Proofpoint-Spam-Details: 
MIME-Version: 1.0
Received: 
To: myaddress@here.com
From: &quot;Somebody&quot; &lt;somebody@me.com&gt;
Subject: Their Subject Line #12345
Date: Sun, 26 May 2013 15:39:54 +0000 (GMT)
X-Mailer: iCloud Mail (1Q)
X-Originating-IP: 
Message-ID: &lt;9978818f-2c21-4e00-8f0c-
094d6ec1c0e8@me.com&gt;
X-TMWD-Spam-Summary: 
X-MMS-Spam-Filter-ID: 
X-WSS-ID: 
Content-Type: multipart/alternative;
 boundary=&quot;Boundary_(ID_ZcR2Vul4mq27B0g0wvFLMg)&quot;

[snipped]

--Boundary_(ID_AcW2oBwQSJ6m0TXXzf7xzw)
Content-ID: &lt;35b9249a-1162-4ba3-ab6f-
1518661e1b61@icloud.com&gt;
Content-Type: application/pdf;
 name*1*=utf-
8''%48%6F%75%73%65%20%49%6E%73%75%72%61;
 name*2*=%6E%63%65%2E%70%64%66
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
 filename*1*=utf-
8''%48%6F%75%73%65%20%49%6E%73%75%72%61;
 filename*2*=%6E%63%65%2E%70%64%66

I am running on Gentoo Linux. The PEAR versions are as 
follows:

dev-php/PEAR-Mail 1.2.0
dev-php/PEAR-Mail_Mime 1.8.7
dev-php/PEAR-Mail_mimeDecode 1.5.5

Test script:
---------------
&lt;?php
/* simple script to work around the issue */
$mime = &quot;attachment; filename*1*=utf-8''%48%6F%75%73%65%20%49%6E%73%75%72%61; filename*2*=%6E%63%65%2E%70%64%66&quot;;
var_dump(
	preg_match_all(
		'/(?&lt;=filename\*\d\*=)[^;]+(?=;|$)/',
		$mime,
		$matches ),
	urldecode( implode( '', $matches[0] ) )
);
?&gt;

Expected result:
----------------
# print_r( $part-&gt;ctype_parameters );
Array
(
    [name] =&gt; House Insurance.pdf
)

# print_r( $part-&gt;headers );
Array
(
	[content-id] =&gt; &lt;35b9249a-1162-4ba3-ab6f-
1518661e1b61@icloud.com&gt;
	[content-type] =&gt; application/pdf; name=House 
Insurance.pdf
	[content-transfer-encoding] =&gt; base64
	[content-disposition] =&gt; attachment; filename=House 
Insurance.pdf
)


Actual result:
--------------
# print_r( $part-&gt;ctype_parameters );
Array
(
    [name*1*] =&gt; utf-
8%48%6F%75%73%65%20%49%6E%73%75%72%61
    [name*2*] =&gt; %6E%63%65%2E%70%64%66
)

# print_r( $part-&gt;headers );
Array
(
	[content-id] =&gt; &lt;35b9249a-1162-4ba3-ab6f-
1518661e1b61@icloud.com&gt;
	[content-type] =&gt; application/pdf; name*1*=utf-
8''%48%6F%75%73%65%20%49%6E%73%75%72%61; 
name*2*=%6E%63%65%2E%70%64%66
	[content-transfer-encoding] =&gt; base64
	[content-disposition] =&gt; attachment; filename*1*=utf-
8''%48%6F%75%73%65%20%49%6E%73%75%72%61; 
filename*2*=%6E%63%65%2E%70%64%66
)</pre>]]></description>
      <dc:date>2013-07-04T18:39:38+00:00</dc:date>
      <dc:creator>randalla &amp;#x61;&amp;#116; gmail &amp;#x64;&amp;#111;&amp;#x74; com</dc:creator>
      <dc:subject>Mail_mimeDecode Feature/Change Request</dc:subject>
    </item>
</rdf:RDF>
