From ad2785a2d95ee092ebe65c719c002b8be321a145 Mon Sep 17 00:00:00 2001 From: Camilo Rodriguez Date: Tue, 24 Oct 2017 18:09:10 +0000 Subject: [PATCH] CRM-21328: Protect Array Access with Unexisting Keys Changed direct access to $currentOption array by using the CRM_Utils_Array::value() wrapper, so no notices are issued. --- CRM/Event/Form/Registration/Register.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CRM/Event/Form/Registration/Register.php b/CRM/Event/Form/Registration/Register.php index f2418bfc02..109e1ba289 100644 --- a/CRM/Event/Form/Registration/Register.php +++ b/CRM/Event/Form/Registration/Register.php @@ -594,8 +594,12 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { continue; } elseif ($hideAdminValues && !in_array($className, $formClasses)) { + $publicVisibilityID = CRM_Price_BAO_PriceField::getVisibilityOptionID('public'); + $adminVisibilityID = CRM_Price_BAO_PriceField::getVisibilityOptionID('admin'); + foreach ($options as $key => $currentOption) { - if ($currentOption['visibility_id'] == CRM_Price_BAO_PriceField::getVisibilityOptionID('admin')) { + $optionVisibility = CRM_Utils_Array::value('visibility_id', $currentOption, $publicVisibilityID); + if ($optionVisibility == $adminVisibilityID) { unset($options[$key]); } } -- 2.25.1