From c7d6492f433278cb1829b0e3398bf08372c11026 Mon Sep 17 00:00:00 2001 From: terrafrost Date: Sun, 16 Sep 2012 18:50:16 -0500 Subject: [PATCH] stat() and lstat() ignore false output from _stat() Thanks Fluffycloud! --- phpseclib/Net/SFTP.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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