# Case folding with following whitespace in MIME headers

- Thread: https://externals.io/message/114109
- Original archive: https://news-web.php.net/php.internals/114109
- Started by Christoph M. Becker on 2021-04-23T13:48:30+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #114109 — Christoph M. Becker — 2021-04-23T13:48:30+00:00

URL: https://externals.io/message/114109#114109

Hi all,

while working on a fix[1] for bug #80259[2], I noticed that
 `iconv_mime_decode()` and `mb_decode_mimeheader()` collapse all whitespace
after a case folding marker (CRLF) to a single space[3].  This appears
to be in violation of RFC 5322, section 2.2.3:

| Unfolding is accomplished by simply removing any CRLF
| that is immediately followed by WSP.

imap_utf8() properly keeps the whitespace.  (ext/imap is not available
on 3v4l.org)

I wonder whether it's worth to fix it, due to the obvious BC break, or
whether we want to treat that as a documentation issue.  If we're going
for a fix (what I would suggest), which version should that target?

[1] <https://github.com/php/php-src/pull/6865>
[2] <https://bugs.php.net/80259>
[3] <https://3v4l.org/E92VT>

--
Christoph M. Becker
