ZF-7547: Zend_Mail_Protocol_Imap::_decodeLine incorrectly parses some kind of strings

Issue Type: Bug Created: 2009-08-10T04:55:17.000+0000 Last Updated: 2009-11-14T06:17:16.000+0000 Status: Resolved Fix version(s): - 1.9.6 (24/Nov/09)

Reporter: Sergei Stolyarov (cancel) Assignee: Satoru Yoshida (satoruyoshida) Tags: - Zend_Mail_Storage

Related issues: - ZF-7978

Attachments: - patch.diff


For example, call $imap->_decodeLine('("A B C")') returns array('"A', 'B', 'C"') instead of array('"A B C"')

In the same time calls like $imap->_decodeLine('(X "A B C")') are working fine: array('X', '"A B C"')

$imap is an instance of Zend_Mail_Protocol_Imap (visibility modifier changed from protected to public for testing purposes).

This bug affects IMAP responses parsing and makes IMAP using almost impossible. For example, IMAP request like "FETCH 1 (ENVELOPE)" returns garbage instead of valid envelope.


Posted by Sergei Stolyarov (cancel) on 2009-08-10T05:04:22.000+0000

The problem could be saved by replacing line

if (preg_match('%^"((.|\\|\")*?)" *%', $line, $matches)) {


if (preg_match('%^("((.|\\|\")?)" *%', $line, $matches)) {

added '(*'

Posted by Sergei Stolyarov (cancel) on 2009-08-10T05:06:47.000+0000

proposed fix for Zend/Mail/Protocol/Imap.php

Posted by Satoru Yoshida (satoruyoshida) on 2009-08-19T07:00:22.000+0000

Memo: unit test Zend/Mail/ImapTest.php uses Zend/Mail/Protocol/Imap.php.

Posted by Benjamin Eberlei (beberlei) on 2009-09-18T02:41:25.000+0000

Moved to correct component

Posted by Satoru Yoshida (satoruyoshida) on 2009-11-14T06:17:16.000+0000

Solved in SVN r18976(trunk), r18977(1.9 branch)

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.