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.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 3312979-php-warning-access-offset-array.patch | 790 bytes | capysara |
Issue fork salesforce-3312979
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
Comment #3
capysara commentedI opened a merge request and am attaching a patch for review.
Comment #4
capysara commentedComment #6
aaronbaumanMerged, thanks for the patch!