From: Jon goldberg Date: Thu, 11 Feb 2016 23:16:23 +0000 (-0500) Subject: CRM-17029 - fix notices X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=26016861a98e47dbe8b2945036f0880134a17e07;p=civicrm-core.git CRM-17029 - fix notices --- 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,