diff --git a/phpseclib/Net/SSH2.php b/phpseclib/Net/SSH2.php index 120b796d..f39e3786 100644 --- a/phpseclib/Net/SSH2.php +++ b/phpseclib/Net/SSH2.php @@ -4070,7 +4070,9 @@ class SSH2 } $this->bitmap = 0; - fclose($this->fsock); + if (is_resource($this->fsock) && get_resource_type($this->fsock) == 'stream') { + fclose($this->fsock); + } return false; }