From ef9785d9c5b855faccfb0b3d4baf113df24ea12d Mon Sep 17 00:00:00 2001 From: terrafrost Date: Sun, 10 May 2020 23:51:16 -0500 Subject: [PATCH] SFTP: if /path/to/file is a file then /path/to/file/whatever errors --- phpseclib/Net/SFTP.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/phpseclib/Net/SFTP.php b/phpseclib/Net/SFTP.php index 59c760bab..7165b57af 100644 --- a/phpseclib/Net/SFTP.php +++ b/phpseclib/Net/SFTP.php @@ -1257,6 +1257,9 @@ function _remove_from_stat_cache($path) $temp = &$this->stat_cache; $max = count($dirs) - 1; foreach ($dirs as $i => $dir) { + if (!is_array($temp)) { + return false; + } if ($i === $max) { unset($temp[$dir]); return true; @@ -1283,6 +1286,9 @@ function _query_stat_cache($path) $temp = &$this->stat_cache; foreach ($dirs as $dir) { + if (!is_array($temp)) { + return null; + } if (!isset($temp[$dir])) { return null; }