Issues

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

Issue Type: Improvement Created: 2008-09-13T21:06:06.000+0000 Last Updated: 2012-03-21T10:46:13.000+0000 Status: Resolved Fix version(s): - 1.7.0 (17/Nov/08)

Reporter: Alexandre Lemaire (saeven) Assignee: Satoru Yoshida (satoruyoshida) Tags: - Zend_Mail

Related issues: Attachments:

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:

<pre class="highlight">
$this->_socket = @fsockopen($host, $port);

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

<pre class="highlight">
$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:

<pre class="highlight">
$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.

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts