|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63254 iconv_mime_encode() counts field name in the line-length limit
Submitted: 2012-10-10 14:32 UTC Modified: 2018-08-25 16:07 UTC
Avg. Score:3.3 ± 0.5
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: narf at bofh dot bg Assigned: cmb (profile)
Status: Not a bug Package: ICONV related
PHP Version: Irrelevant OS: Linux, Ubuntu
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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: narf at bofh dot bg
New email:
PHP Version: OS:


 [2012-10-10 14:32 UTC] narf at bofh dot bg
RFC 2045 specifies that the line-length (an iconv_mime_encode() preference, default 76) applies to all characters in the header's BODY, excluding the CRLF.

iconv_mime_encode() however will count the header name (which it doesn't need to know btw) in it as well. So, if I for example want to create a Subject header, iconv_mime_encode() will effectively give its first line the limit of ...:

default length = 76
'Subject: ' length = 9
67 characters.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2018-08-25 16:07 UTC]
-Status: Open +Status: Not a bug -Assigned To: +Assigned To: cmb
 [2018-08-25 16:07 UTC]
RFC 2045[1] does not apply to iconv_mime_encode(), since the
function is about encoding MIME *headers*, but the RFC is about
message *bodies*.  Instead RFC 2047[2] is relevant for the
function, and it states in section 2:

| While there is no limit to the length of a multiple-line header
| field, each line of a header field that contains one or more
|'encoded-word's is limited to 76 characters.

So counting the field name length is sensible.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sat Dec 04 09:03:37 2021 UTC