php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67207 imap_headerinfo bug for utf8-encoded "from" header field
Submitted: 2014-05-05 11:20 UTC Modified: 2016-04-04 18:29 UTC
Votes:3
Avg. Score:4.3 ± 0.9
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: e dot lemanissier at physioflow dot com Assigned:
Status: Open Package: IMAP related
PHP Version: 5.4.28 OS:
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2014-05-05 11:20 UTC] e dot lemanissier at physioflow dot com
Description:
------------
When using the imap_headerinfo on an email with an utf8 encoded from header (for example =?utf-8?q?D=C3=A9tection_de_spam_=3Cnoreply=401and1=2Efr=3E?), the returned variable does not have any from field. The from information is however available if imap_rfc822_parse_headers(imap_fetchheader()) is used.



Test script:
---------------
var_dump(imap_headerinfo($this->mbox, $mid));
var_dump(imap_fetchheader($this->mbox, $mid));
var_dump(imap_rfc822_parse_headers(imap_fetchheader($this->mbox, $mid)));

Expected result:
----------------
object(stdClass)#22 (17) {
  ["date"]=>
  string(31) "Fri, 11 Apr 2014 03:27:57 +0100"
  ["Date"]=>
  string(31) "Fri, 11 Apr 2014 03:27:57 +0100"
  ["subject"]=>
  string(72) "Rapport quotidien du dossier Spam du compte email support@XXX.com"
  ["Subject"]=>
  string(72) "Rapport quotidien du dossier Spam du compte email support@XXX.com"
  ["message_id"]=>
  string(46) "<0MRpI7-1WRWOS48ML-00Skij@spamreport.1and1.fr>"
  ["toaddress"]=>
  string(22) "support@XXX.com"
  ["to"]=>
  array(1) {
    [0]=>
    object(stdClass)#26 (2) {
      ["mailbox"]=>
      string(7) "support"
      ["host"]=>
      string(14) "XXX.com"
    }
  }
  ["fromaddress"]=>
  string(69) "=?utf-8?q?D=C3=A9tection_de_spam_=3Cnoreply=401and1=2Efr=3E?=@UNKNOWN"
  ["from"]=>
  array(1) {
    [0]=>
    object(stdClass)#29 (2) {
      ["mailbox"]=>
      string(61) "=?utf-8?q?D=C3=A9tection_de_spam_=3Cnoreply=401and1=2Efr=3E?="
      ["host"]=>
      string(7) "UNKNOWN"
    }
  }
  ["Recent"]=>
  string(1) " "
  ["Unseen"]=>
  string(1) " "
  ["Flagged"]=>
  string(1) " "
  ["Answered"]=>
  string(1) " "
  ["Deleted"]=>
  string(1) " "
  ["Draft"]=>
  string(1) " "
  ["Msgno"]=>
  string(4) "   1"
  ["MailDate"]=>
  string(26) "11-Apr-2014 01:27:57 +0000"
  ["Size"]=>
  string(3) "922"
  ["udate"]=>
  int(1397179677)
}
string(655) "Return-Path: <>
Delivery-Date: Fri, 11 Apr 2014 03:27:57 +0100
Received: from spamreport by localhost id 0MRpI7-1WRWOS48ML-00Skij for
        support@XXX.com (mailbox m51559649-71621086);
        Fri, 11 Apr 2014 03:27:57 +0100
From: =?utf-8?q?D=C3=A9tection_de_spam_=3Cnoreply=401and1=2Efr=3E?=
Subject: Rapport quotidien du dossier Spam du compte email
        support@XXX.com
Date: Fri, 11 Apr 2014 03:27:57 +0100
To: <support@XXX.com>
Message-Id: <0MRpI7-1WRWOS48ML-00Skij@spamreport.1and1.fr>
Envelope-To: support@XXX.com
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable

"
object(stdClass)#27 (13) {
  ["date"]=>
  string(31) "Fri, 11 Apr 2014 03:27:57 +0100"
  ["Date"]=>
  string(31) "Fri, 11 Apr 2014 03:27:57 +0100"
  ["subject"]=>
  string(72) "Rapport quotidien du dossier Spam du compte email support@XXX.com"
  ["Subject"]=>
  string(72) "Rapport quotidien du dossier Spam du compte email support@XXX.com"
  ["message_id"]=>
  string(46) "<0MRpI7-1WRWOS48ML-00Skij@spamreport.1and1.fr>"
  ["toaddress"]=>
  string(22) "support@XXX.com"
  ["to"]=>
  array(1) {
    [0]=>
    object(stdClass)#28 (2) {
      ["mailbox"]=>
      string(7) "support"
      ["host"]=>
      string(14) "XXX.com"
    }
  }
  ["fromaddress"]=>
  string(69) "=?utf-8?q?D=C3=A9tection_de_spam_=3Cnoreply=401and1=2Efr=3E?=@UNKNOWN"
  ["from"]=>
  array(1) {
    [0]=>
    object(stdClass)#29 (2) {
      ["mailbox"]=>
      string(61) "=?utf-8?q?D=C3=A9tection_de_spam_=3Cnoreply=401and1=2Efr=3E?="
      ["host"]=>
      string(7) "UNKNOWN"
    }
  }
  ["reply_toaddress"]=>
  string(69) "=?utf-8?q?D=C3=A9tection_de_spam_=3Cnoreply=401and1=2Efr=3E?=@UNKNOWN"
  ["reply_to"]=>
  array(1) {
    [0]=>
    object(stdClass)#30 (2) {
      ["mailbox"]=>
      string(61) "=?utf-8?q?D=C3=A9tection_de_spam_=3Cnoreply=401and1=2Efr=3E?="
      ["host"]=>
      string(7) "UNKNOWN"
    }
  }
  ["senderaddress"]=>
  string(69) "=?utf-8?q?D=C3=A9tection_de_spam_=3Cnoreply=401and1=2Efr=3E?=@UNKNOWN"
  ["sender"]=>
  array(1) {
    [0]=>
    object(stdClass)#31 (2) {
      ["mailbox"]=>
      string(61) "=?utf-8?q?D=C3=A9tection_de_spam_=3Cnoreply=401and1=2Efr=3E?="
      ["host"]=>
      string(7) "UNKNOWN"
    }
  }
}


Actual result:
--------------
object(stdClass)#22 (17) {
  ["date"]=>
  string(31) "Fri, 11 Apr 2014 03:27:57 +0100"
  ["Date"]=>
  string(31) "Fri, 11 Apr 2014 03:27:57 +0100"
  ["subject"]=>
  string(72) "Rapport quotidien du dossier Spam du compte email support@XXX.com"
  ["Subject"]=>
  string(72) "Rapport quotidien du dossier Spam du compte email support@XXX.com"
  ["message_id"]=>
  string(46) "<0MRpI7-1WRWOS48ML-00Skij@spamreport.1and1.fr>"
  ["toaddress"]=>
  string(22) "support@XXX.com"
  ["to"]=>
  array(1) {
    [0]=>
    object(stdClass)#26 (2) {
      ["mailbox"]=>
      string(7) "support"
      ["host"]=>
      string(14) "XXX.com"
    }
  }
  ["Recent"]=>
  string(1) " "
  ["Unseen"]=>
  string(1) " "
  ["Flagged"]=>
  string(1) " "
  ["Answered"]=>
  string(1) " "
  ["Deleted"]=>
  string(1) " "
  ["Draft"]=>
  string(1) " "
  ["Msgno"]=>
  string(4) "   1"
  ["MailDate"]=>
  string(26) "11-Apr-2014 01:27:57 +0000"
  ["Size"]=>
  string(3) "922"
  ["udate"]=>
  int(1397179677)
}
string(655) "Return-Path: <>
Delivery-Date: Fri, 11 Apr 2014 03:27:57 +0100
Received: from spamreport by localhost id 0MRpI7-1WRWOS48ML-00Skij for
        support@XXX.com (mailbox m51559649-71621086);
        Fri, 11 Apr 2014 03:27:57 +0100
From: =?utf-8?q?D=C3=A9tection_de_spam_=3Cnoreply=401and1=2Efr=3E?=
Subject: Rapport quotidien du dossier Spam du compte email
        support@XXX.com
Date: Fri, 11 Apr 2014 03:27:57 +0100
To: <support@XXX.com>
Message-Id: <0MRpI7-1WRWOS48ML-00Skij@spamreport.1and1.fr>
Envelope-To: support@XXX.com
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable

"
object(stdClass)#27 (13) {
  ["date"]=>
  string(31) "Fri, 11 Apr 2014 03:27:57 +0100"
  ["Date"]=>
  string(31) "Fri, 11 Apr 2014 03:27:57 +0100"
  ["subject"]=>
  string(72) "Rapport quotidien du dossier Spam du compte email support@XXX.com"
  ["Subject"]=>
  string(72) "Rapport quotidien du dossier Spam du compte email support@XXX.com"
  ["message_id"]=>
  string(46) "<0MRpI7-1WRWOS48ML-00Skij@spamreport.1and1.fr>"
  ["toaddress"]=>
  string(22) "support@XXX.com"
  ["to"]=>
  array(1) {
    [0]=>
    object(stdClass)#28 (2) {
      ["mailbox"]=>
      string(7) "support"
      ["host"]=>
      string(14) "XXX.com"
    }
  }
  ["fromaddress"]=>
  string(69) "=?utf-8?q?D=C3=A9tection_de_spam_=3Cnoreply=401and1=2Efr=3E?=@UNKNOWN"
  ["from"]=>
  array(1) {
    [0]=>
    object(stdClass)#29 (2) {
      ["mailbox"]=>
      string(61) "=?utf-8?q?D=C3=A9tection_de_spam_=3Cnoreply=401and1=2Efr=3E?="
      ["host"]=>
      string(7) "UNKNOWN"
    }
  }
  ["reply_toaddress"]=>
  string(69) "=?utf-8?q?D=C3=A9tection_de_spam_=3Cnoreply=401and1=2Efr=3E?=@UNKNOWN"
  ["reply_to"]=>
  array(1) {
    [0]=>
    object(stdClass)#30 (2) {
      ["mailbox"]=>
      string(61) "=?utf-8?q?D=C3=A9tection_de_spam_=3Cnoreply=401and1=2Efr=3E?="
      ["host"]=>
      string(7) "UNKNOWN"
    }
  }
  ["senderaddress"]=>
  string(69) "=?utf-8?q?D=C3=A9tection_de_spam_=3Cnoreply=401and1=2Efr=3E?=@UNKNOWN"
  ["sender"]=>
  array(1) {
    [0]=>
    object(stdClass)#31 (2) {
      ["mailbox"]=>
      string(61) "=?utf-8?q?D=C3=A9tection_de_spam_=3Cnoreply=401and1=2Efr=3E?="
      ["host"]=>
      string(7) "UNKNOWN"
    }
  }
}


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-08-29 16:09 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2015-08-29 16:09 UTC] cmb@php.net
I'm not able to reproduce this issue with "recent" versions of
libc-client (2007e and 2007f). Which version do you use (see PHP
info)? Which OS are you running?
 [2015-08-31 08:57 UTC] e dot lemanissier at physioflow dot com
-Status: Feedback +Status: Assigned
 [2015-08-31 08:57 UTC] e dot lemanissier at physioflow dot com
from phpinfo:

PHP Version 5.5.28
System	Linux info 3.0 #1337 SMP Tue Jan 01 00:00:00 CEST 2000 all GNU/Linux
IMAP c-Client Version	2007e
 [2016-04-04 18:29 UTC] cmb@php.net
-Assigned To: cmb +Assigned To:
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sun Aug 18 20:01:27 2019 UTC