diff --git a/phpseclib/Net/SFTP.php b/phpseclib/Net/SFTP.php index 31330086..0b0a3c1d 100644 --- a/phpseclib/Net/SFTP.php +++ b/phpseclib/Net/SFTP.php @@ -886,6 +886,9 @@ class Net_SFTP extends Net_SSH2 { } $stat = $this->_stat($filename, NET_SFTP_STAT); + if ($stat === false) { + return false; + } $pwd = $this->pwd; $stat['type'] = $this->chdir($filename) ? @@ -918,6 +921,9 @@ class Net_SFTP extends Net_SSH2 { $lstat = $this->_stat($filename, NET_SFTP_LSTAT); $stat = $this->_stat($filename, NET_SFTP_STAT); + if ($stat === false) { + return false; + } if ($lstat != $stat) { return array_merge($lstat, array('type' => NET_SFTP_TYPE_SYMLINK)); @@ -1958,4 +1964,4 @@ class Net_SFTP extends Net_SSH2 { $this->pwd = false; parent::_disconnect($reason); } -} +} \ No newline at end of file