From 5de5d45bd5163b1c974eaab0eae410fdd643645c Mon Sep 17 00:00:00 2001 From: terrafrost Date: Wed, 29 Aug 2012 17:55:22 -0500 Subject: [PATCH] Workaround for buggy stream_select's Workaround for this issue: https://bugs.php.net/bug.php?id=42682 Thanks solefald! --- phpseclib/Net/SSH2.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpseclib/Net/SSH2.php b/phpseclib/Net/SSH2.php index d27d3c08..7ceddb47 100644 --- a/phpseclib/Net/SSH2.php +++ b/phpseclib/Net/SSH2.php @@ -801,7 +801,7 @@ class Net_SSH2 { stream_set_blocking($this->fsock, false); // on windows this returns a "Warning: Invalid CRT parameters detected" error - if (!@stream_select($read, $write, $except, $timeout - $elapsed)) { + if (!@stream_select($read, $write, $except, $timeout - $elapsed) && !count($read)) { user_error(rtrim("Cannot connect to $host. Banner timeout"), E_USER_NOTICE); return; } @@ -2183,7 +2183,7 @@ class Net_SSH2 { $start = strtok(microtime(), ' ') + strtok(''); // http://php.net/microtime#61838 // on windows this returns a "Warning: Invalid CRT parameters detected" error - if (!@stream_select($read, $write, $except, $this->curTimeout)) { + if (!@stream_select($read, $write, $except, $this->curTimeout) && !count($read)) { stream_set_blocking($this->fsock, true); $this->_close_channel($client_channel); return true;