Suggested commit message (feel free to change / doublecheck contributors, I scanned manually):
#84883 by earnie, ximo, netbjarne, scor, greggles, pillarsdotnet, DuaelFr, roderik: make Unicode::mimeHeaderEncode() conform to RFC 2047.
mime_header_encode() in Drupal < 8) does not conform to RFC 2047 standards, particularly to one bit in section 2:
An 'encoded-word' may not be more than 75 characters long, including
'charset', 'encoding', 'encoded-text', and delimiters. If it is
desirable to encode more text than will fit in an 'encoded-word' of
75 characters, multiple 'encoded-word's (separated by CRLF SPACE) may
This non-conformance was apparently introduced on purpose, given the current comments on the method/function (introduced july 2005, commit #11a4aba by Steven):
* Using \n as the chunk separator may cause problems on some systems and
* may have to be changed to \r\n or \r.
...so people with problems would have to hack their own solution in case or problems. Which was apparently because of (issues related to) restrictions in PHP's mail() function:
$subject - Subject of the email to be sent.
Caution: This must not contain any newline characters, or the mail may not be sent properly.
The 'chunk size' of 47 is not correct, resulting in errors because of the length of encoded lines being longer than 75 characters.
The combination of 2 bugs probably contributed to confusion around pinpointing the exact cause(s).
Until #95, people were trying to remove any newlines from the (encoded) subject header, to solve reported problems. (Which does not conform to the RFC). Plus figuring out where they came from.
The separator and chunk size were first introduced in #105, after which there were relatively few diversions.
The patch does two things, besides adding a test / changing comments:
- Change the separator for encoded chunks to CRLF SPACE, as per the RFC
- Decrease the chunk size to 45
review latest patch.
User interface changes
Data model changes
Beta phase evaluation
|Issue category||Bug because sending mail breaks (in easily reproducible situations)|
|Issue priority||Major because same|
|Prioritized changes||Improves stability; fixes clear bug; backport to D7/D6|
PASSED: [[SimpleTest]]: [PHP 5.5 MySQL] 101,466 pass(es). View