php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #40462 Add a mode to lowercase header names in iconv_mime_decode_headers()
Submitted: 2007-02-13 14:34 UTC Modified: 2021-03-03 13:36 UTC
Votes:3
Avg. Score:4.0 ± 0.8
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: php-bug-0702 at nico dot edtinger dot at Assigned:
Status: Open Package: ICONV related
PHP Version: 5.2.1 OS: -
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: php-bug-0702 at nico dot edtinger dot at
New email:
PHP Version: OS:

 

 [2007-02-13 14:34 UTC] php-bug-0702 at nico dot edtinger dot at
Description:
------------
In RFC 822 all header names are defined as case independent. Therefore it would be useful if a mode exists that lowercases all header names and also merge multiple headers with the lowercased name in iconv_mime_decode_header().

It is possible to do that after iconv_mime_decode_header(), but merging multiple headers needs a fair amount of code, which is also already in iconv_mime_decode_header().

Reproduce code:
---------------
$message = <<<ETX
received: line 1
RECEIVED: line 2
Received: line 3
Subject: test
ETX;

var_dump(iconv_mime_decode_headers($message, ICONV_MIME_DECODE_LOWER));

Expected result:
----------------
array(2) {
  ["received"]=>
  array(4) {
    [0]=>
    string(6) "line 1"
    [1]=>
    string(6) "line 2"
    [2]=>
    string(6) "line 3"
    [3]=>
    string(6) "line 4"
  }
  ["subject"]=>
  string(4) "test"
}

Actual result:
--------------
// currently not possible - with the default mode:
array(4) {
  ["received"]=>
  string(6) "line 1"
  ["RECEIVED"]=>
  string(6) "line 2"
  ["Received"]=>
  array(2) {
    [0]=>
    string(6) "line 3"
    [1]=>
    string(6) "line 4"
  }
  ["Subject"]=>
  string(4) "test"
}


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-08-05 00:15 UTC] cmb@php.net
-Package: Feature/Change Request +Package: ICONV related
 [2021-03-03 13:36 UTC] cmb@php.net
Ugh, yeah, that's bad: <https://3v4l.org/G0FS2#v730>.

At least it is documented now:
<https://github.com/php/doc-en/commit/d7dbb4196a9aa0f95732f0a19106ee6db51f0bf9>.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 18:01:29 2024 UTC