fix(files_external): Check key exists before accessing it

Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
pull/47976/head
Git'Fellow 2024-09-14 11:21:17 +07:00 committed by backportbot[bot]
parent b5347e89e7
commit 8a7cd1aefb
1 changed files with 8 additions and 4 deletions

@ -441,10 +441,14 @@ class SFTP extends Common {
try {
$stat = $this->getConnection()->stat($this->absPath($path));
$mtime = $stat ? (int)$stat['mtime'] : -1;
$size = $stat ? (int)$stat['size'] : 0;
return ['mtime' => $mtime, 'size' => $size, 'ctime' => -1];
$mtime = isset($stat['mtime']) ? (int)$stat['mtime'] : -1;
$size = isset($stat['size']) ? (int)$stat['size'] : 0;
return [
'mtime' => $mtime,
'size' => $size,
'ctime' => -1
];
} catch (\Exception $e) {
return false;
}