From 7a9418e4e02a3da7950b6b85c30e694d68daf995 Mon Sep 17 00:00:00 2001 From: terrafrost Date: Wed, 23 Dec 2020 10:39:00 -0600 Subject: [PATCH] SSH2: suppress errors on stream_select calls --- phpseclib/Net/SSH2.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/phpseclib/Net/SSH2.php b/phpseclib/Net/SSH2.php index 4b63cd01..4b84afef 100644 --- a/phpseclib/Net/SSH2.php +++ b/phpseclib/Net/SSH2.php @@ -1251,7 +1251,7 @@ class SSH2 $start = microtime(true); $sec = floor($this->curTimeout); $usec = 1000000 * ($this->curTimeout - $sec); - if (stream_select($read, $write, $except, $sec, $usec) === false) { + if (@stream_select($read, $write, $except, $sec, $usec) === false) { $this->is_timeout = true; return false; } @@ -3194,9 +3194,9 @@ class SSH2 if ($this->curTimeout <= 0) { if ($this->keepAlive <= 0) { - stream_select($read, $write, $except, null); + @stream_select($read, $write, $except, null); } else { - if (!stream_select($read, $write, $except, $this->keepAlive)) { + if (!@stream_select($read, $write, $except, $this->keepAlive)) { $this->send_binary_packet(pack('CN', NET_SSH2_MSG_IGNORE, 0)); return $this->get_binary_packet(true); } @@ -3213,7 +3213,7 @@ class SSH2 $start = microtime(true); if ($this->keepAlive > 0 && $this->keepAlive < $this->curTimeout) { - if (!stream_select($read, $write, $except, $this->keepAlive)) { + if (!@stream_select($read, $write, $except, $this->keepAlive)) { $this->send_binary_packet(pack('CN', NET_SSH2_MSG_IGNORE, 0)); $elapsed = microtime(true) - $start; $this->curTimeout-= $elapsed; @@ -3226,8 +3226,8 @@ class SSH2 $sec = floor($this->curTimeout); $usec = 1000000 * ($this->curTimeout - $sec); - // on windows this returns a "Warning: Invalid CRT parameters detected" error - if (!stream_select($read, $write, $except, $sec, $usec)) { + // this can return a "stream_select(): unable to select [4]: Interrupted system call" error + if (!@stream_select($read, $write, $except, $sec, $usec)) { $this->is_timeout = true; return true; }