In _fillCiviCRMData check if $element exists before trying access offsets

Created on 8 April 2023, about 1 year ago
Updated 18 July 2023, 12 months ago

1.0 Problem/Motivation

In _fillCiviCRMData() line 196 it attempts to get the element for a given key based on submission data, and then checks the $element as an array even if it is NULL: if (!empty($val) && $element['#type'] == 'civicrm_options') {

But I found it's possible that there is no longer such an element no longer exists but the previous submissions are still there. I'm guessing in normal conditions the UI would clean up the previous submissions but it's no guarantee.

2.0 Detailed steps to reproduce (embed screenshots)

I can't think of any easy way to reproduce.

3.0 Proposed resolution

Skip the $element if it's NULL since it's obviously not a 'civicrm_options' type.

πŸ› Bug report
Status

Fixed

Version

6.2

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada nubeli

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024