Issues

ZF-4284: Allow the specification of connection timeouts for network Protocols

Description

It's a critical oversight imo, that the Zend_Mail classes do not permit the specification of a timeout value when using network-connect protocols.

As example reference, consider

Zend_Mail_Protocol_Imap on line 88:


$this->_socket = @fsockopen($host, $port);

should be replaced with a call that includes a timeout variable that can be set in the transport config.


$errno = "";
$errstr = "";
$this->_socket = @fsockopen($host, $port, $errno, $errstr, $this->THE_TIMEOUT );

In addition, the $errno and $errstr variables should be leveraged to provide better error reporting, eg:


$this->_socket = @fsockopen($host, $port, $errno, $errstr, 10 );
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 : ' .$errstr );
        }

This is easy to implement, and may provide more salient error reporting than 'cannot connect to host'.

Comments

Solved in SVN r12480

Changes on constant name in SVN r12539. Because protocol can be recognizable by the class name.

Changing issues in preparation for the 1.7.0 release.