diff --git a/phpseclib/Net/SFTP.php b/phpseclib/Net/SFTP.php index 9a0213a6..dafd94c0 100644 --- a/phpseclib/Net/SFTP.php +++ b/phpseclib/Net/SFTP.php @@ -1120,6 +1120,9 @@ class SFTP extends SSH2 $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; @@ -1146,6 +1149,9 @@ class SFTP extends SSH2 $temp = &$this->stat_cache; foreach ($dirs as $dir) { + if (!is_array($temp)) { + return null; + } if (!isset($temp[$dir])) { return null; }