Skip to content

mb_decode_mimeheader does not handle separator #20674

Closed

Description

@ewwink

Description

if encoded Subject are too long they need to be separated the block by space ?= =? or line break, but mb_decode_mimeheader does not handle it correctly

The following code:

<?php

$subject = '=?us-ascii?Q?The_PH?=  =?us-ascii?Q?P_8.5?=';
echo  mb_decode_mimeheader($subject) ;

PHP 8.3.21, 8.4.10 Result:

The PH  P 8.5

PHP 8.0.30, 7.4.33 Result:

The_PHP_8.5

But I expected this output instead, as iconv_mime_decode does:

The PHP 8.5

PHP Version

8.3.21, 8.4.10

Operating System

Ubuntu 24.04

Activity

  1. iluuu1994 commented on Dec 9, 2025

    @iluuu1994
    Member
  2. added a commit that references this issue on Dec 10, 2025
    d29c866
  3. youkidearitai commented on Dec 10, 2025

    @youkidearitai
    Contributor

    I create a commit this fix issue: youkidearitai@d29c866. @alexdowad what do you think?

  4. youkidearitai commented on Dec 10, 2025

    @youkidearitai
    Contributor

    In RFC2047

    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
    be used.

    Should be separated by CRLF SPACE if 'encoded-word' is more than 75 characters.

  5. added a commit that references this issue on Dec 15, 2025
    0056d01
  6. added a commit that references this issue on Dec 15, 2025
    85913fc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions