Bug #80201 [Opn->Ana]: incomplete header returned
Edit report at https://bugs.php.net/bug.php?id=80201&edit=1
ID: 80201
Updated by: cmb@php.net
Reported by: smile dot 80 at bk dot ru
Summary: incomplete header returned
-Status: Open
+Status: Analyzed
Type: Bug
Package: IMAP related
Operating System: linux/windows
PHP Version: 7.4.11
Block user comment: N
Private report: N
New Comment:
Form the mail_fetchheader_full() documentation:
| If the len argument is non-NIL, it holds a pointer in which the
| length of the string in octets is returned. This is useful in
| cases where there may be an embedded null in the string.
We do pass NIL to mail_fetchheader_full(), though, and as such
imap_fetchheader() truncates the string. The fix is trivial, but
while investigating further I found bug #80203, and it seems to me
there are more cases where the IMAP extension does not properly
handle NUL bytes.
Previous Comments:
------------------------------------------------------------------------
[2020-10-07 18:41:54] smile dot 80 at bk dot ru
Description:
------------
---
From manual page: https://php.net/function.imap-fetchheader
---
It is difficult to describe the error.
The letter header contains the # 00 symbol in the header value. It is included in the ASCII table
and does not contradict RFC 2822.
Imap_fetchheader returns all headers up to # 00.
For example heading:
Message-Id: <20201007090331 .3VdeNwPA @ mxfront10o.mail.yandex.net>
Where after ..0331 (# 00)
The function will return (string) "Message-Id: <20201007090331"
Test script:
---------------
imap_fetchheader ( $imap_stream , $$msg_number );
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=80201&edit=1
Thread (3 messages)