Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.4.1

Bug #723 Timeout for connect cannot be set
Submitted: 2004-02-10 11:56 UTC
From: schst Assigned: toby
Status: Closed Package: Net_FTP
PHP Version: Irrelevant OS: Irrelevant
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 39 - 29 = ?

 
 [2004-02-10 11:56 UTC] schst
Description: ------------ If connecting to a host, there's no way to spefify a timeout. This will halt the script in the worst case. PHP's ftp_* functions support timeouts since 4.2...

Comments

 [2004-02-17 00:53 UTC] pear-dev at mocsnik dot hu
reviewed. some help for toby :) timeout may be set on ftp_connect() and changed later using ftp_set_option($conn_id, FTP_TIMEOUT_SEC, $value); No reason to have $_timeout, work with runtime FTP options directly. function connect ( $host = null, $port = null, $timeout = FTP_TIMEOUT_SEC ) { [..] $handle = @ftp_connect($this->getHostname(), $this->getPort(), $timeout); [..] } /** * Set the timeout * * @access public * @param int $timeout Timeout to set */ function setTimeout ( $timeout ) { ftp_set_option($this->_handle, FTP_TIMEOUT_SEC, $timeout); } /** * Returns the timeout * * @access public * @return int $timeout Current timeout value */ function getTimeout ( ) { return ftp_get_option($this->_handle, FTP_TIMEOUT_SEC); } more info from the php manual: "[FTP_TIMEOUT_SEC is a constant] defined by this [=ftp] extension, and will only be available when the extension has either been compiled into PHP or dynamically loaded at runtime. " IMHO there's no sense of using Net_FTP package without this extension so this note can be ignored. "FTP_TIMEOUT_SEC (integer) See ftp_set_option() for information." -> "FTP_TIMEOUT_SEC Changes the timeout in seconds used for all network related functions. value must be an integer that is greater than 0. The default timeout is 90 seconds." -- if you are already in the source please remove one of these duplicated lines: * Set the Username * Set the Username
 [2004-02-17 20:36 UTC] pear-dev at mocsnik dot hu
grr.. validation.. "FTP_TIMEOUT_SEC: value must be an integer that is greater than 0." function setTimeout ( $timeout ) { if ( (is_int($timeout)) && ($timeout > 0) ) ftp_set_option($this->_handle, FTP_TIMEOUT_SEC, $timeout); } else { return new PEAR_Error('Timeout has to be an integer > 0'); } }
 [2004-03-14 13:16 UTC] toby
This bug has been fixed in CVS. In case this was a documentation problem, the fix will show up at the end of next Sunday (CET) on pear.php.net. In case this was a pear.php.net website problem, the change will show up on the website in short time. Thank you for the report, and for helping us make PEAR better.