From ef4c11d262fa6d21dabc39b3fc9f12c54ad87488 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Tue, 15 Dec 2015 11:50:57 +0100 Subject: [PATCH] Better checks for defined array indexes --- classes/File_redirection.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/classes/File_redirection.php b/classes/File_redirection.php index bb8ffc8c61..adafab2ec5 100644 --- a/classes/File_redirection.php +++ b/classes/File_redirection.php @@ -196,11 +196,11 @@ class File_redirection extends Managed_DataObject $redir->httpcode = $redir_info['code']; $redir->redirections = intval($redir_info['redirects']); $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->size = $redir_info['size']; - $redir->file->date = $redir_info['time']; - if ($redir_info['protected']) { + $redir->file->size = isset($redir_info['size']) ? $redir_info['size'] : null; + $redir->file->date = isset($redir_info['time']) ? $redir_info['time'] : null; + if (isset($redir_info['protected']) && !empty($redir_info['protected'])) { $redir->file->protected = true; } } -- 2.39.5