From 91a4b4c67e1b11add121cf85cdbfd8a1c84db5d9 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Thu, 3 Oct 2019 11:28:43 +0100 Subject: [PATCH] Event::sendMail() - Don't assume $postProfileID has content The unit-test suite includes cases in which the value is actually NULL. --- CRM/Event/BAO/Event.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/CRM/Event/BAO/Event.php b/CRM/Event/BAO/Event.php index 4765a29b1c..ec9d0e6b48 100644 --- a/CRM/Event/BAO/Event.php +++ b/CRM/Event/BAO/Event.php @@ -1143,9 +1143,14 @@ WHERE civicrm_event.is_active = 1 // @todo - the goal is that all params available to the message template are explicitly defined here rather than // 'in a smattering of places'. Note that leakage can happen between mailings when not explicitly defined. - $customPostTitles = empty($profilePost[1]) ? NULL : []; - foreach ($postProfileID as $offset => $id) { - $customPostTitles[$offset] = CRM_Core_BAO_UFGroup::getFrontEndTitle((int) $id); + if ($postProfileID) { + $customPostTitles = empty($profilePost[1]) ? NULL : []; + foreach ($postProfileID as $offset => $id) { + $customPostTitles[$offset] = CRM_Core_BAO_UFGroup::getFrontEndTitle((int) $id); + } + } + else { + $customPostTitles = NULL; } $tplParams = array_merge($values, $participantParams, [ 'email' => $email, -- 2.25.1