ZF-8163: Zend_Mail_Protocol_Imap connect method throws possibly misleading exception message on socket open failure

Issue Type: Bug Created: 2009-10-27T17:29:34.000+0000 Last Updated: 2009-10-28T23:25:22.000+0000 Status: Resolved Fix version(s): - 1.9.6 (24/Nov/09)

Reporter: Filipus Klutiero (chealer) Assignee: Satoru Yoshida (satoruyoshida) Tags: - Zend_Mail

Related issues: Attachments:


Zend_Mail_Protocol_Imap->connect() throws an exception this way is fsockopen fails:

<pre class="highlight">
        $this->_socket = @fsockopen($host, $port, $errno, $errstr, self::TIMEOUT_CONNECTION);
        if (!$this->_socket) {
             * @see Zend_Mail_Protocol_Exception
            require_once 'Zend/Mail/Protocol/Exception.php';
            throw new Zend_Mail_Protocol_Exception('cannot connect to host : ' . $errno . ' : ' . $errstr);

So for example, in case of a timeout, the exception has the following message:

<pre class="highlight">
cannot connect to host : 110 : Connection timed out

When I got this trying to connect to an IMAP server, I figured the Zend-based software was trying to connect via POP3, which uses port 110, and that for some reason the error missed the hostname but only showed the port. I realized in the end that 110 wasn't a port but an errno. It is not entirely wrong though to expect a hostname after "host :". I would suggest this form instead:

<pre class="highlight">
'Cannot connect to host. connect(): error ' . $errno . ' (' . $errstr . ')'


Posted by Satoru Yoshida (satoruyoshida) on 2009-10-28T21:18:51.000+0000

Thank you for report and sorry for patience, Filipus.

Solved in svn r18730 (trunk), r18731 (1.9branch).

Posted by Filipus Klutiero (chealer) on 2009-10-28T23:25:19.000+0000

Come on... I've rarely seen issues treated so fast.

Thank you

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.