diff --git a/phpseclib/Net/SSH2.php b/phpseclib/Net/SSH2.php index 5274aee4..af88fb0a 100644 --- a/phpseclib/Net/SSH2.php +++ b/phpseclib/Net/SSH2.php @@ -1,5 +1,4 @@ bitmap & NET_SSH2_MASK_CONSTRUCTOR) || !$this->_connect()) { - return false; + if (!($this->bitmap & NET_SSH2_MASK_CONSTRUCTOR)) { + if (!$this->_connect()) { + return false; + } } $args = array_slice(func_get_args(), 1);