Req #40462 [Opn]: Add a mode to lowercase header names in iconv_mime_decode_headers()

From: Date: Wed, 03 Mar 2021 13:36:40 +0000
Subject: Req #40462 [Opn]: Add a mode to lowercase header names in iconv_mime_decode_headers()
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-232508@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=40462&edit=1 ID: 40462 Updated by: cmb@php.net Reported by: php-bug-0702 at nico dot edtinger dot at Summary: Add a mode to lowercase header names in iconv_mime_decode_headers() Status: Open Type: Feature/Change Request Package: ICONV related Operating System: - PHP Version: 5.2.1 Block user comment: N Private report: N New Comment: Ugh, yeah, that's bad: <https://3v4l.org/G0FS2#v730>. At least it is documented now: <https://github.com/php/doc-en/commit/d7dbb4196a9aa0f95732f0a19106ee6db51f0bf9>. Previous Comments: ------------------------------------------------------------------------ [2007-02-13 14:34:13] 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" } ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=40462&edit=1

« previous php.bugs (#232508) next »