From 217fb9710f87cb80a31437b8bd6f0f671f7d18b1 Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Thu, 14 Apr 2016 10:31:56 -0400 Subject: [PATCH] oops: Fix crash processing emails with attachments --- include/class.mailfetch.php | 3 ++- include/class.thread.php | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/class.mailfetch.php b/include/class.mailfetch.php index 325300f7b..7333992a4 100644 --- a/include/class.mailfetch.php +++ b/include/class.mailfetch.php @@ -757,7 +757,8 @@ class MailFetcher { // Validate and save immediately try { - $file['id'] = $fileField->uploadAttachment($file); + if ($f = $fileField->uploadAttachment($file)) + $file['id'] = $f->getId(); } catch (FileUploadError $ex) { $file['error'] = $file['name'] . ': ' . $ex->getMessage(); diff --git a/include/class.thread.php b/include/class.thread.php index 42b18ec98..f6a2a1730 100644 --- a/include/class.thread.php +++ b/include/class.thread.php @@ -971,6 +971,7 @@ implements TemplateVariable { } function createAttachments(array $files) { + $attachments = array(); foreach ($files as $info) { if ($A = $this->createAttachment($info, @$info['name'] ?: false)) $attachments[] = $A; -- GitLab