diff options
author | Christopher Geelen <christopher.geelen@vinotion.nl> | 2016-07-14 14:13:19 +0200 |
---|---|---|
committer | Christopher Geelen <christopher.geelen@vinotion.nl> | 2016-07-14 14:15:39 +0200 |
commit | 160c0b885eb4f1a1a1baa2b6b9fc6d99fdb80d0c (patch) | |
tree | 42e61fe6a3f76c7405bb28a164541e5e9f85228f | |
parent | 3622c32f9975555db259dbef48522ce4bbec4993 (diff) |
FIX: empty eventData retrieval (issue #2406)
-rw-r--r-- | app/Job/NotificationJob.php | 11 |
1 files changed, 7 insertions, 4 deletions
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; } } |