|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #66184 Executing of imap_fetchstructure() cause server connection crash
Submitted: 2013-11-27 15:19 UTC Modified: 2018-04-08 18:40 UTC
From: wniestolik at betasoft dot pl Assigned: cmb (profile)
Status: Not a bug Package: IMAP related
PHP Version: 5.4.22 OS: Windows/Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: wniestolik at betasoft dot pl
New email:
PHP Version: OS:


 [2013-11-27 15:19 UTC] wniestolik at betasoft dot pl
imap_fetchstructure method sends to server folowing query:

FETCH 375 (UID ENVELOPE BODY.PEEK[HEADER.FIELDS (Newsgroups Content-MD5 Content-Disposition Content-Language Content-Location Followup-To References)]  BODYSTRUCTURE INTERNALDATE RFC822.SIZE FLAGS)

Problem is, that the generated query has double space in 'References)]  BODYSTRUCTURE'. Many servers (eg. Exchange) after receive that query close connection immediately with message 'IMAP protocol error'.

It seems, that there's no possibility to prevent this other than update IMAP library. So, for servers with strict IMAP protocol parser, method imap_fetchstructure is completely useless. Please help!

From manual page:

Test script:
Just execute imap_fetchstructure() on any email account and capture generated query.

Expected result:
Execution of imap_fetchstructure sends correct IMAP query without redundant white spaces.

Actual result:
Execution of imap_fetchstructure sends incorrect IMAP query with redundant white spaces.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2018-04-08 18:40 UTC]
-Status: Open +Status: Not a bug -Assigned To: +Assigned To: cmb
 [2018-04-08 18:40 UTC]
This is an issue of the underlying libc-client (namely of
mail_fetchstructure_full()), so we can't do anything about it.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Fri Jun 09 15:03:37 2023 UTC