php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #55146 iconv_mime_decode_headers() skips some headers
Submitted: 2011-07-06 08:49 UTC Modified: 2011-07-16 04:56 UTC
Votes:9
Avg. Score:4.9 ± 0.3
Reproduced:7 of 7 (100.0%)
Same Version:7 (100.0%)
Same OS:7 (100.0%)
From: dmitry at spamexperts dot com Assigned:
Status: Open Package: ICONV related
PHP Version: Irrelevant OS: Debian Squeeze
Private report: No CVE-ID:
Have you experienced this issue?
Rate the importance of this bug to you:

 [2011-07-06 08:49 UTC] dmitry at spamexperts dot com
Description:
------------
If ICONV_MIME_DECODE_CONTINUE_ON_ERROR mode is switched on the mime_decode_headers() function parses well-formed headers wrongly. Using of ICONV_MIME_DECODE_STRICT mode solve the problem.

Test script:
---------------
<?php

$headers = <<< HEADERS
X-Header-One: H4sIAAAAAAAAA+NgFlsCAAA=
X-Header-Two: XtLePq6GTMn8G68F0
HEADERS;

echo 'Wrong decoding:<br /><pre>';
var_dump(iconv_mime_decode_headers($headers, ICONV_MIME_DECODE_CONTINUE_ON_ERROR));
echo '</pre>';

echo 'Correct decoding:<br /><pre>';
var_dump(iconv_mime_decode_headers($headers, ICONV_MIME_DECODE_STRICT));
echo '</pre>';


Expected result:
----------------
Expected result is shown in the test script under "Correct decoding".

Actual result:
--------------
One header is missing from the result

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-07-16 01:33 UTC] lonnyk at gmail dot com
I am trying to test/fix this, but I do not know what encoding you are trying to 
decode this to. Can you please let us know what encoding you are trying to decode 
the headers to?

Thank you!
 [2011-07-16 04:53 UTC] dmitry at spamexperts dot com
The whole application is using UTF-8 encoding, also if I add 

iconv_set_encoding('internal_encoding', 'UTF-8');
iconv_set_encoding('input_encoding', 'UTF-8');
iconv_set_encoding('output_encoding', 'UTF-8');

at the beginning of the test script the bug is still actual. Hope that helps, if 
not - feel free to ask me for any info you need.

Thanks!
 [2011-07-16 04:56 UTC] dmitry at spamexperts dot com
If you mean encoding of the X-Header-One header contents 
(H4sIAAAAAAAAA+NgFlsCAAA=) - that's just a random set of chars.
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Sat Apr 19 14:01:50 2014 UTC