diff --git a/phpseclib/Net/SFTP.php b/phpseclib/Net/SFTP.php index 3d49ce0a..2826a607 100644 --- a/phpseclib/Net/SFTP.php +++ b/phpseclib/Net/SFTP.php @@ -2090,7 +2090,9 @@ class SFTP extends SSH2 $this->touch($remote_file, $stat['mtime'], $stat['atime']); } - fclose($fp); + if (isset($fp) && is_resource($fp)) { + fclose($fp); + } } return $this->_close_handle($handle);