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; }