Problem/Motivation
PHP 8 started marking as deprecated passing a null parameter where a string is expected. This caused the following warning:
Deprecated function: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in Drupal\salesforce_mapping\SalesforceMappingFieldPluginBase->pushValue() (line 243 of modules/contrib/salesforce/modules/salesforce_mapping/src/SalesforceMappingFieldPluginBase.php).
Steps to reproduce
I'm not sure how to produce this on a vanilla site. It's reproducible on the client's site by logging in with one of the user fields empty.
Proposed resolution
Check for empty before sending to strlen().
Remaining tasks
Test patch.
User interface changes
API changes
Data model changes
None of these are affected.
Comments
Comment #2
michelleComment #3
vmarchuk@Michelle
The patch from comment #2 works fine. Thanks!
Comment #4
manuvelasco commentedThe patch from #2 works fine.
Comment #5
capysara commentedI 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 to Salesforce, but this deprecation warning would display.
Using Salesforce 5.0.0, Drupal 9.4.7, and php 8.1.10, patch applies cleanly and I no longer get the php warning.
Comment #6
capysara commentedComment #8
aaronbaumanMerged, thanks for the patch!