ZF-7978: method Zend_Mail_Protocol_Imap::_decodeLine() incorrectly parse some tokens

Issue Type: Bug Created: 2009-09-29T23:27:14.000+0000 Last Updated: 2009-10-08T15:25:03.000+0000 Status: Resolved Fix version(s): - 1.9.4 (13/Oct/09)

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

Related issues: - ZF-7547



Try to parse (using Zend_Mail_Protocol_Imap::_decodeLine() ) the following line "* STATUS blurdybloop (MESSAGES 231 UNSEEN 0)", in the result you'll miss last "0" token. It's because of incorrect parsing of tokens in the following code fragment (file Zend/Mail/Protocol/Imap.php)

<pre class="highlight">
                // only add if token had more than just closing braces
                if ($token) {
                    $tokens[] = $token;

In input line above last token is "0" but expression "if ($token) {" treat it as numeric 0 and hence as a FALSE value. So instead of adding string "0" code ignores it.


Posted by Satoru Yoshida (satoruyoshida) on 2009-10-08T05:34:49.000+0000

Sergei, I think following code, do you think? If "(some strings 0 )" would be passed, it seems to work fine.

<pre class="highlight">
if (rtrim($token) != '') {
    $tokens[] = rtrim($token);

Posted by Sergei Stolyarov (cancel) on 2009-10-08T09:41:41.000+0000

Yes, it looks fine for me.

Posted by Satoru Yoshida (satoruyoshida) on 2009-10-08T15:24:52.000+0000

Thanks, solved at SVN r18498 in trunk

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.