Better checks for defined array indexes

This commit is contained in:
Mikael Nordfeldth 2015-12-15 11:50:57 +01:00
parent 0d39337683
commit ef4c11d262

View File

@ -196,11 +196,11 @@ class File_redirection extends Managed_DataObject
$redir->httpcode = $redir_info['code']; $redir->httpcode = $redir_info['code'];
$redir->redirections = intval($redir_info['redirects']); $redir->redirections = intval($redir_info['redirects']);
$redir->file = new File(); $redir->file = new File();
$redir->file->url = $redir_info ? $redir_info['url'] : $in_url; $redir->file->url = $redir_info['url'];
$redir->file->mimetype = $redir_info['type']; $redir->file->mimetype = $redir_info['type'];
$redir->file->size = $redir_info['size']; $redir->file->size = isset($redir_info['size']) ? $redir_info['size'] : null;
$redir->file->date = $redir_info['time']; $redir->file->date = isset($redir_info['time']) ? $redir_info['time'] : null;
if ($redir_info['protected']) { if (isset($redir_info['protected']) && !empty($redir_info['protected'])) {
$redir->file->protected = true; $redir->file->protected = true;
} }
} }