From 160c0b885eb4f1a1a1baa2b6b9fc6d99fdb80d0c Mon Sep 17 00:00:00 2001 From: Christopher Geelen Date: Thu, 14 Jul 2016 14:13:19 +0200 Subject: FIX: empty eventData retrieval (issue #2406) --- app/Job/NotificationJob.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'app') diff --git a/app/Job/NotificationJob.php b/app/Job/NotificationJob.php index 904a9273..907e543b 100644 --- a/app/Job/NotificationJob.php +++ b/app/Job/NotificationJob.php @@ -58,10 +58,6 @@ class NotificationJob extends BaseJob { $values = array(); - if (! empty($event['changes'])) { - $values['changes'] = $event['changes']; - } - switch ($eventObjectName) { case 'Kanboard\Event\TaskEvent': $values['task'] = $this->taskFinderModel->getDetails($event['task_id']); @@ -80,6 +76,13 @@ class NotificationJob extends BaseJob break; } + // Need to use an array filter to remove any unset/null values in $values. This can happen e.g. + // when receiving an event for a task, but the task is already removed. This can happen when + // using the Kanboard background worker thread. + $values = array_filter($values); + if (!empty($values) && !empty($event['changes'])) { + $values['changes'] = $event['changes']; + } return $values; } } -- cgit v1.2.3