Problem/Motivation

Salesforce PHP 8.5 Deprecation Fixes

Steps to reproduce

After upgrading to PHP 8.5 just browse the site and the warnings will appear.

Proposed resolution

Patch file: patches/salesforce/salesforce-php85-deprecations.patch

16 hunks across 14 files, consolidated into a single patch.

Issue 1: Deprecated (double) cast (2 hunks)

PHP 8.5 deprecates (double) as a cast alias — (float) must be used instead.

File: SalesforceMappingFieldPluginBase.php (lines 222, 297)

Two case 'double': branches that cast field values using (double) were changed to (float).

Issue 2: Implicitly nullable parameters (14 hunks)

PHP 8.5 deprecates typed parameters with = NULL default that don't have an explicit ? nullable marker.

E.g. SomeType $param = NULL must become ?SomeType $param = NULL.

File Method Parameter(s) fixed
MappedObject.php setDrupalEntity() ?EntityInterface $entity
MappedObject.php setDrupalEntityStub() ?EntityInterface $entity
MappedObjectInterface.php setDrupalEntityStub() ?EntityInterface $entity
MappedObjectInterface.php setDrupalEntity() ?EntityInterface $entity
SalesforceExceptionEvent.php __construct() ?\Throwable $e
SalesforceNoticeEvent.php __construct() ?\Throwable $e
SalesforceWarningEvent.php __construct() ?\Throwable $e
SalesforceErrorEvent.php __construct() ?\Throwable $e
RestException.php __construct() ?ResponseInterface $response, ?\Exception $previous
EntityNotFoundException.php __construct() ?\Throwable $previous
SalesforceMappingFieldsForm.php getRow() ?FieldPluginInterface $field_plugin
SalesforceMappedObjectAddLocalAction.php getTitle() ?Request $request
SalesforceMappingController.php editTitle() ?EntityInterface $_entity
SalesforceMappingController.php fieldsTitle() ?EntityInterface $_entity
PullController.php endpoint() ?SalesforceMappingInterface $salesforce_mapping
PullController.php populateQueue() ?SalesforceMappingInterface $mapping, ?SFID $id

Why these are needed

Without these fixes, PHP 8.5 emits deprecation notices at runtime for every call to these functions, which will become fatal errors in PHP 9.0. The (double) cast is similarly deprecated in favor of the canonical (float).

CommentFileSizeAuthor
salesforce-php85-deprecations.patch7.73 KBbotelho

Issue fork salesforce-3589138

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

botelho created an issue. See original summary.

aaronbauman’s picture

Status: Active » Needs review

Thanks for the contrib.

Drupal 10 does not support php 8.5, so this is not going to get into the 5.1.x branch.

A 6.x branch is probably the appropriate target for this.

liam morland’s picture

Version: 5.1.2 » 6.0.x-dev
Status: Needs review » Needs work
Issue tags: +Needs merge request

liam morland’s picture

Status: Needs work » Needs review

It looks like most of these were fixed in #3551878: PHP 8.4 deprecations .

liam morland’s picture

Issue tags: -Needs merge request