Problem/Motivation

After updating to php 8.1, I started seeing some deprecation warnings. One of the warnings I saw was addressed in https://www.drupal.org/project/salesforce/issues/3304404, but I was also getting
Warning: Trying to access array offset on value of type null in Drupal\salesforce_webform\Plugin\SalesforceMappingField\WebformElements->value() (line 84 of modules/contrib/salesforce/modules/salesforce_webform/src/Plugin/SalesforceMappingField/WebformElements.php).

Steps to reproduce

Salesforce configuration is pretty involved, so I'm not sure how to reproduce on a vanilla site. In my case:
I am using Salesforce with webform, pushing to SF to create objects when a webform is submitted. I submitted some webforms to Drupal, but they were not successfully pushed to SF. I made some changes to the mapping configuration and then ran cron. Cron successfully pushed the webform submissions to Salesforce, but this deprecation warning would display.

Proposed resolution

Add another check for to be sure $value isn't null.

Remaining tasks

I'll add a patch and a merge request.

Issue fork salesforce-3312979

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

capysara created an issue. See original summary.

capysara’s picture

StatusFileSize
new790 bytes

I opened a merge request and am attaching a patch for review.

capysara’s picture

Assigned: capysara » Unassigned
Status: Active » Needs review

  • AaronBauman committed fb9e3e5 on 5.0.x
    Issue #3312979 by capysara: PHP warning: Trying to access array offset...
aaronbauman’s picture

Status: Needs review » Fixed

Merged, thanks for the patch!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.