Deprecated function: substr(): Passing null to parameter #1 ($string) of type string is deprecated in Drupal\salesforce_mapping\SalesforceMappingFieldPluginBase->pullValue()

Created on 11 April 2023, over 1 year ago
Updated 3 August 2023, over 1 year ago

Problem/Motivation

Null values no longer allowed as first parameter to substr. "$value = substr($value, 0, 19);" in "pullValue" does not check for null.

Steps to reproduce

Create a mapping that pulls a date value from SF. Attempt pulling a null value for that date on a site running PHP 8.1. Observe PHP warning in watchdog: Deprecated function: substr(): Passing null to parameter #1 ($string) of type string is deprecated in Drupal\salesforce_mapping\SalesforceMappingFieldPluginBase->pullValue() (line 285 of /code/web/modules/contrib/salesforce/modules/salesforce_mapping/src/SalesforceMappingFieldPluginBase.php)

Proposed resolution

Ensure that first param is a string prior to calling substr

Remaining tasks

User interface changes

None

API changes

None

Data model changes

None

πŸ› Bug report
Status

Fixed

Version

5.0

Component

salesforce_mapping.module

Created by

πŸ‡ΊπŸ‡ΈUnited States sean_fremouw

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

Comments & Activities

Production build 0.71.5 2024