Issues

ZF-2439: Zend_Mail_Storage_Pop3 method getUniqueId does not work properly when there are no messages on the server and UIDL extension is unsupported

Issue Type: Bug Created: 2008-01-15T18:49:12.000+0000 Last Updated: 2008-03-21T16:25:28.000+0000 Status: Resolved Fix version(s): - 1.5.0 (17/Mar/08)

Reporter: Chris Utz (baron314159) Assignee: Nico Edtinger (nico) Tags: - Zend_Mail

Related issues: Attachments:

Description

The following is the code of the getUniqueId method in Zend_Mail_Storage_Pop3:

<pre class="highlight">
public function getUniqueId($id = null)
{   
    if (!$this->hasUniqueid) {
        if ($id) {
            return $id;
        }
        $range = range(1, $this->countMessages());
        return array_combine($range, $range);
    }   

    return $this->_protocol->uniqueid($id);
}

Note the call to the range function. According to the PHP documentation, range() will generate a descending sequence if the 2nd parameter is smaller. The getUniqueId method depends on range returning an empty array if countMessages returns 0, which it does not.

The following code works as intended:

<pre class="highlight">
public function getUniqueId($id = null)
{   
    if (!$this->hasUniqueid) {
        if ($id) {
            return $id;
        }

        $numMessages = $this->countMessages();

        if ($numMessages == 0) {
            return array();
        } else {
            $range = range(1, $numMessages);
            return array_combine($range, $range);
        }
    }

    return $this->_protocol->uniqueid($id);
}

NB - I've checked the problem is still present in the trunk.

Comments

No comments to display

Have you found an issue?

See the Overview section for more details.

Copyright

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

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

Contacts