In WebformCivicrmPostProcess::modifyWebSubmissionData() check if $element exists before trying to access offsets

Created on 18 July 2023, over 1 year ago
Updated 30 July 2023, over 1 year ago

1.0 Problem/Motivation

Getting error:

Trying to access array offset on value of type null WebformCivicrmPostProcess.php:167

In WebformCivicrmPostProcess::modifyWebSubmissionData() it attempts to get the element for a given key based on submission data, and then attempts to use the $element without checking that it exists.

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'm getting this error when using webform_civicrm_migrate to migrate submissions from Drupal 7 to Drupal 9.

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.0

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.71.5 2024