|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72016 mailparse_rfc822_parse_addresses removes space in display element
Submitted: 2016-04-13 14:59 UTC Modified: 2021-09-02 11:38 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: jochem dot blok at fasterforward dot nl Assigned:
Status: Verified Package: mailparse (PECL)
PHP Version: 5.6.20 OS: Ubuntu 14.04
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
49 - 22 = ?
Subscribe to this entry?

 [2016-04-13 14:59 UTC] jochem dot blok at fasterforward dot nl
While parsing the addresslist from a mime mail the mailparse_rfc822_parse_addresses is used to split the name from the address. This function removes a space which is in the name.

Test script:
$a = mailparse_rfc822_parse_addresses('Foo Bar é [TEST] <>');

Expected result:
array(1) {
  array(3) {
    string(17) "Foo Bar é [TEST]"
    string(11) ""

Actual result:
array(1) {
  array(3) {
    string(16) "Foo Bar é[TEST]"
    string(11) ""


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2020-10-20 09:19 UTC] sander at onlineactivity dot nl
Happens with ? and ! as well

Hello? ee e! ee <>

parses as

Hello?ee e!ee

On PHP 7.4.11 / Mailparse 3.1.1 / CentOS 7
 [2021-09-02 11:38 UTC]
-Status: Open +Status: Verified
 [2021-09-02 11:38 UTC]
I can confirm the reported behavior.  However, this is an invalid
email address according to RFC 822 and 2822, since neither spaces
nor brackets are valid dot-atoms, and the local part is not and
does not contain quoted-strings. The proper address

    '"Foo Bar é [TEST]" <>'

is parsed as expected, as well as the obsolete variant

    'Foo Bar é "[TEST]" <>'

Anyhow, the parser should not return the actual result, at least
not without signalling some kind of failure.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Jul 23 23:01:30 2024 UTC