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
Posted by old of Satoru Yoshida (yoshida@zend.co.jp) on 2008-11-09T05:05:53.000+0000
Solved in SVN r12480
Posted by old of Satoru Yoshida (yoshida@zend.co.jp) on 2008-11-10T18:50:42.000+0000
Changes on constant name in SVN r12539. Because protocol can be recognizable by the class name.
Posted by Wil Sinclair (wil) on 2008-11-13T14:10:19.000+0000
Changing issues in preparation for the 1.7.0 release.