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

Description

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


        $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:


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:


'Cannot connect to host. connect(): error ' . $errno . ' (' . $errstr . ')'

Comments

Thank you for report and sorry for patience, Filipus.

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

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

Thank you