Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot list folders when a folder contains " #188

Open
cedric-anne opened this issue Jul 11, 2022 · 0 comments
Open

Cannot list folders when a folder contains " #188

cedric-anne opened this issue Jul 11, 2022 · 0 comments
Labels
Bug Something isn't working

Comments

@cedric-anne
Copy link
Contributor

Bug Report

Q A
Version(s) 2.16.0

Summary

When a folder contains " at the end of its name, the Laminas\Mail\Storage\Imap::getFolders() method fails due to an infinite loop in Laminas\Mail\Protocol\Imap::decodeLine().

Current behavior

Here is an extract of the request/response stack.

< * OK The Microsoft Exchange IMAP4 service is ready.
> TAG1 LOGIN "****@****/****" "********"
< TAG1 OK LOGIN completed.
> TAG2 SELECT "INBOX"
< * 449 EXISTS
< * 0 RECENT
< * FLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)
< * OK [PERMANENTFLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)] Permanent flags
< * OK [UNSEEN 57] Is the first unseen message
< * OK [UIDVALIDITY 14] UIDVALIDITY value
< * OK [UIDNEXT 4928] The next unique identifier value
< TAG2 OK [READ-WRITE] SELECT completed.
> TAG3 LIST "" "*"
< * LIST (\HasNoChildren) "/" Calendar
> TAG4 LOGOUT
< * LIST (\HasChildren) "/" Contacts
< * LIST (\HasNoChildren \Trash) "/" "Deleted Items"
< * LIST (\HasNoChildren \Drafts) "/" Drafts
< * LIST (\Marked \HasChildren) "/" INBOX
< * LIST (\HasChildren) "/" "INBOX/&AOA- trier"
< * LIST (\HasNoChildren) "/" "INBOX/&AOA- trier/_DONE/2021/2021-08/2021-08-17/2021-08-17_Printer &- Login"
< * LIST (\HasNoChildren) "/" "INBOX/&AOA- trier/_DONE/2021/2021-08/2021-08-17/2021-08-17_Webmail"
< * LIST (\HasNoChildren) "/" {57}
< INBOX/&AOA- trier/_DONE/2021/2021-08/2021-08-18_Ecran 27"
< * LIST (\HasNoChildren) "/" "INBOX/&AOA- trier/_DONE/2021/2021-08/2021-08-19_Download .msg file"
< * LIST (\HasNoChildren) "/" Journal
< * LIST (\HasNoChildren \Junk) "/" "Junk Email"
< * LIST (\HasNoChildren) "/" Notes
< * LIST (\HasNoChildren) "/" Outbox
< * LIST (\HasNoChildren) "/" Sent
< * LIST (\HasNoChildren \Sent) "/" "Sent Items"
< * LIST (\HasNoChildren) "/" Tasks
< * LIST (\HasChildren) "/" Trash
< * LIST (\HasNoChildren) "/" Trash/TEST
< TAG3 OK LIST completed.
< * BYE Microsoft Exchange Server 2016 IMAP4 server signing off.
< TAG4 OK LOGOUT completed.

The directory that contains " is returned on 2 distinct lines, using the literal notation.

< * LIST (\HasNoChildren) "/" {57}
< INBOX/&AOA- trier/_DONE/2021/2021-08/2021-08-18_Ecran 27"

How to reproduce

Call Laminas\Mail\Storage\Imap::getFolders() on a mailbox that has a folder that ends with a ".

Expected behavior

Should not produce an infinite loop in Laminas\Mail\Protocol\Imap::decodeLine().

@cedric-anne cedric-anne added the Bug Something isn't working label Jul 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant