Zend Framework

Zend_Mail_Protocol_Imap connect method throws possibly misleading exception message on socket open failure

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Trivial Trivial
  • Resolution: Fixed
  • Affects Version/s: 1.9.5
  • Fix Version/s: 1.9.6
  • Component/s: Zend_Mail
  • Labels:
    None
  • Fix Version Priority:
    Should Have

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 . ')'

Activity

Hide
Satoru Yoshida added a comment -

Thank you for report and sorry for patience, Filipus.

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

Show
Satoru Yoshida added a comment - Thank you for report and sorry for patience, Filipus. Solved in svn r18730 (trunk), r18731 (1.9branch).
Hide
Filipus Klutiero added a comment -

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

Thank you

Show
Filipus Klutiero added a comment - Come on... I've rarely seen issues treated so fast. Thank you

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: