php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63839 iconv_mime_decode_headers function is skipping headers
Submitted: 2012-12-23 14:48 UTC Modified: 2018-08-25 12:46 UTC
Votes:4
Avg. Score:4.5 ± 0.9
Reproduced:3 of 3 (100.0%)
Same Version:1 (33.3%)
Same OS:1 (33.3%)
From: nidhikaushal28 at gmail dot com Assigned: cmb (profile)
Status: Closed Package: ICONV related
PHP Version: 5.3.20 OS: Windows 7, CentOS
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: nidhikaushal28 at gmail dot com
New email:
PHP Version: OS:

 

 [2012-12-23 14:48 UTC] nidhikaushal28 at gmail dot com
Description:
------------
iconv_mime_decode_headers function is skipping headers when '=?' is present in the subject. 

For example if the subject header of a mime message is : 
Subject: Reply Is? white side-LED =? in Help

Then the rest of the headers after subject like content-type, date etc are not returned. Similar bug is filed https://bugs.php.net/bug.php?id=52941 but in the above mentioned example the subject is not encoded. 

My php version is 5.3.3 and the issue is reproducible in 5.3.20 and 5.4.10. 

Test script:
---------------
<?php
$headers = 'From: "xyz" <xyz@xyz.com>
To: <xyz@xyz.com>
Subject: Reply Is? white side-LED =? in Help
Date: Sat, 22 Dec 2012
Message-ID: <006f01cde00e$d9f79da0$8de6d8e0>
MIME-Version: 1.0
Content-Type: multipart/alternative;
	boundary="----=_NextPart_000_0070_01CDE03C.F3AFD9A0"
X-Mailer: Microsoft Office Outlook 12.0
Thread-Index: Ac3gDtcH2huHjzYcQVmFJPPoWjJogA==
Content-Language: en-us

';
$headers = iconv_mime_decode_headers($headers, ICONV_MIME_DECODE_CONTINUE_ON_ERROR);
print_r($headers);
?>

Expected result:
----------------
Array
(
    [From] => "xyz" <xyz@xyz.com>
    [To] => <xyz@xyz.com>
    [Subject] => Reply Is? white side-LED =? in Help
    [Date] => Sat, 22 Dec 2012
    [Message-ID] => <006f01cde00e$d9f79da0$8de6d8e0>
    [MIME-Version] => 1.0
    [Content-Type] => multipart/alternative; boundary="----=_NextPart_000_0070_0
1CDE03C.F3AFD9A0"
    [X-Mailer] => Microsoft Office Outlook 12.0
    [Thread-Index] => Ac3gDtcH2huHjzYcQVmFJPPoWjJogA==
    [Content-Language] => en-us
)

Actual result:
--------------
Array
(
    [From] => "xyz" <xyz@xyz.com>
    [To] => <xyz@xyz.com>
    [Subject] => Reply Is? white side-LED
)


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-12-23 17:46 UTC] felipe@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: aharvey
 [2013-01-08 16:52 UTC] Chandakme at gmail dot com
I am also facing same issue and would like to hear more about it?
 [2015-09-09 12:46 UTC] cmb@php.net
-Status: Assigned +Status: Verified
 [2015-09-09 12:46 UTC] cmb@php.net
Confirmed: <https://3v4l.org/9Yb90>

Apparently a problem with wrong detection of encoded words.
 [2017-10-24 05:46 UTC] kalle@php.net
-Status: Verified +Status: Assigned
 [2017-10-24 07:18 UTC] kalle@php.net
-Status: Assigned +Status: Open -Assigned To: aharvey +Assigned To:
 [2018-08-12 21:26 UTC] cmb@php.net
-Status: Open +Status: Verified
 [2018-08-12 21:26 UTC] cmb@php.net
<https://github.com/php/php-src/pull/3440> is supposed to resolve
this issue.
 [2018-08-25 12:46 UTC] cmb@php.net
-Assigned To: +Assigned To: cmb
 [2018-08-25 12:55 UTC] cmb@php.net
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=8754d44167d95a381c9c60beeb26492f4176fe1c
Log: Fix #63839: iconv_mime_decode_headers function is skipping headers
 [2018-08-25 12:55 UTC] cmb@php.net
-Status: Verified +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 15:01:30 2024 UTC