php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69087 imap_headerinfo wrong parse fromaddress header
Submitted: 2015-02-20 09:12 UTC Modified: 2015-08-29 11:47 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:2 (100.0%)
From: piotroo89 at gmail dot com Assigned: cmb (profile)
Status: Not a bug Package: IMAP related
PHP Version: 5.4.38 OS: Debian/Ubuntu
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: piotroo89 at gmail dot com
New email:
PHP Version: OS:

 

 [2015-02-20 09:12 UTC] piotroo89 at gmail dot com
Description:
------------
Debian GNU/Linux 7 - PHP 5.4.36-0+deb7u3
Ubuntu 14.10 - PHP 5.5.12-2ubuntu4.2

Problem with parse imap headers from mailer delivery daemon. Header from isn't properly handled in case when mail came form mailer daemon.

Test script:
---------------
This is mail:

Delivered-To: addr@foo.bar
Received: by 10.64.25.193 with SMTP id e1csp360082ieg;
        Wed, 18 Feb 2015 23:21:19 -0800 (PST)
X-Received: by 10.180.73.241 with SMTP id o17mr7637081wiv.16.1424330476433;
        Wed, 18 Feb 2015 23:21:16 -0800 (PST)
Return-Path: <>
Received: from antyspam.addr@bar.baz (smtp.addr@bar.baz. [0.0.0.0])
        by mx.google.com with ESMTPS id ft7si39444898wjb.169.2015.02.18.23.21.15
        for <addr@foo.bar>
        (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Wed, 18 Feb 2015 23:21:16 -0800 (PST)
Received-SPF: none (google.com: antyspam.addr@bar.baz does not designate permitted sender hosts) client-ip=0.0.0.0;
Authentication-Results: mx.google.com;
       spf=none (google.com: antyspam.addr@bar.baz does not designate permitted sender hosts) smtp.mail=
Received: by antyspam.addr@bar.baz (Spam Firewall)
	id 40635119E0BB; Thu, 19 Feb 2015 08:21:15 +0100 (CET)
Date: Thu, 19 Feb 2015 08:21:15 +0100 (CET)
From: MAILER-DAEMON (Mail Delivery System)
Subject: Undelivered Mail Returned to Sender

$result = imap_headerinfo($, 1);

Expected result:
----------------
stdClass Object
(
    [date] => Thu, 19 Feb 2015 08:21:15 +0100 (CET)
    [Date] => Thu, 19 Feb 2015 08:21:15 +0100 (CET)
    [subject] => Undelivered Mail Returned to Sender
    [Subject] => Undelivered Mail Returned to Sender
    [message_id] => <20150219072115.40635119E0BB@antyspam.foo.foo>
    [fromaddress] => MAILER-DAEMON
    [toaddress] => addr@foo.bar
    [to] => Array
        (
            [0] => stdClass Object
                (
                    [mailbox] => addr
                    [host] => foo.bar
                )

        )

    [Recent] =>  
    [Unseen] => U
    [Flagged] =>  
    [Answered] =>  
    [Deleted] =>  
    [Draft] =>  
    [Msgno] =>  752
    [MailDate] => 20-Feb-2015 08:20:13 +0000
    [Size] => 23704
    [udate] => 1424420413
)


Actual result:
--------------
stdClass Object
(
    [date] => Thu, 19 Feb 2015 08:21:15 +0100 (CET)
    [Date] => Thu, 19 Feb 2015 08:21:15 +0100 (CET)
    [subject] => Undelivered Mail Returned to Sender
    [Subject] => Undelivered Mail Returned to Sender
    [message_id] => <20150219072115.40635119E0BB@antyspam.foo.foo>
    [toaddress] => addr@foo.bar
    [to] => Array
        (
            [0] => stdClass Object
                (
                    [mailbox] => addr
                    [host] => foo.bar
                )

        )

    [Recent] =>  
    [Unseen] => U
    [Flagged] =>  
    [Answered] =>  
    [Deleted] =>  
    [Draft] =>  
    [Msgno] =>  752
    [MailDate] => 20-Feb-2015 08:20:13 +0000
    [Size] => 23704
    [udate] => 1424420413
)


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-08-29 11:47 UTC] cmb@php.net
-Status: Open +Status: Not a bug -Assigned To: +Assigned To: cmb
 [2015-08-29 11:47 UTC] cmb@php.net
The From header field of this email is not valid according to RFC
2822[1]. Therefore it is ignored by imap_headerinfo(), what I
don't consider a bug.

[1] <http://tools.ietf.org/html/rfc2822#section-3.6.2>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 03 10:01:27 2024 UTC