php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75979 mb_encode_mimeheader invalid MIME quoted-printable
Submitted: 2018-02-18 20:12 UTC Modified: 2020-02-13 22:35 UTC
From: azurit at pobox dot sk Assigned: cmb (profile)
Status: Not a bug Package: mbstring related
PHP Version: 7.2.2 OS: linux
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.
Password:
Status:
Package:
Bug Type:
Summary:
From: azurit at pobox dot sk
New email:
PHP Version: OS:

 

 [2018-02-18 20:12 UTC] azurit at pobox dot sk
Description:
------------
Function mb_encode_mimeheader is NOT quoting a colon character (:), which is against RFC, see:
https://tools.ietf.org/html/rfc5322#section-3.2.3

See also this very same Thunderbird bug:
https://bugzilla.mozilla.org/show_bug.cgi?id=1438590

Test script:
---------------
<?php

mb_internal_encoding('UTF-8');
echo mb_encode_mimeheader("test:test", "UTF-8", "Q");

?>

Expected result:
----------------
test=3atest

Actual result:
--------------
test:test

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-02-13 22:35 UTC] cmb@php.net
-Status: Open +Status: Not a bug -Assigned To: +Assigned To: cmb
 [2020-02-13 22:35 UTC] cmb@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

While it is correct that a colon must be quoted inside an
encoded-word, there is no need here to construct an encoded-word,
and so this is not done.  Compare this with

    mb_encode_mimeheader("tést:tést", "UTF-8", "Q")

which needs to construct an encoded-word (due to the non ASCII
characters), and therefore evaluates to

    =?UTF-8?Q?t=C3=A9st=3At=C3=A9st?=
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 15:01:28 2024 UTC