From 26016861a98e47dbe8b2945036f0880134a17e07 Mon Sep 17 00:00:00 2001 From: Jon goldberg Date: Thu, 11 Feb 2016 18:16:23 -0500 Subject: [PATCH] CRM-17029 - fix notices --- CRM/Campaign/Form/Petition/Signature.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CRM/Campaign/Form/Petition/Signature.php b/CRM/Campaign/Form/Petition/Signature.php index a8a477622f..4347a92a7b 100644 --- a/CRM/Campaign/Form/Petition/Signature.php +++ b/CRM/Campaign/Form/Petition/Signature.php @@ -483,7 +483,10 @@ class CRM_Campaign_Form_Petition_Signature extends CRM_Core_Form { $transaction = new CRM_Core_Transaction(); // CRM-17029 - get the add_to_group_id from the _contactProfileFields array. - $firstField = array_shift(array_slice($this->_contactProfileFields, 0, 1)); + // There's a much more elegant solution with + // array_values($this->_contactProfileFields)[0] but it's PHP 5.4+ only. + $slice = array_slice($this->_contactProfileFields, 0, 1); + $firstField = array_shift($slice); $addToGroupID = isset($firstField['add_to_group_id']) ? $firstField['add_to_group_id'] : NULL; $this->_contactId = CRM_Contact_BAO_Contact::createProfileContact($params, $this->_contactProfileFields, $this->_contactId, $addToGroupID, -- 2.25.1