Deprecated function: sleep(): Passing null to parameter #1 ($seconds) of type int is deprecated in Drupal\marketing_cloud\MarketingCloudSession->token

Created on 29 April 2025, about 1 month ago

Problem/Motivation

During the work done in #2972909 and specifically the commit
b4c250aed6364d865f0dbdda315379e7999a61f1,
the configuration variable request_token_wait was renamed to requestToken_wait in the code:

- sleep($config->get('request_token_wait'));
+ sleep($config->get('requestToken_wait'));

The corresponding update in marketing_cloud.settings was not made. As a result, the requestToken_wait key does not exist in the settings configuration, causing it to be NULL at runtime.

A similar issue had previously happened with requestToken_url, but it was corrected in
commit d30844e8dcbf4680c2142232dd71afd213f5dce0.

Steps to reproduce

  1. Install and configure the Marketing Cloud module on a Drupal 10 site.
  2. Trigger a process that involves token request generation (e.g., sending data to Marketing Cloud).

Observed behavior

An error is logged in the Drupal watchdog (recent log messages) when the system tries to execute the sleep() function with a NULL value:

Deprecated function: sleep(): Passing null to parameter #1 ($seconds) of type int is deprecated 
in Drupal\marketing_cloud\MarketingCloudSession->token()

Proposed resolution

  • Add the requestToken_wait configuration key to marketing_cloud.settings with an appropriate default value, similar to the approach used for requestToken_url.
  • Optionally update the configuration schema to reflect the correct default and validation.

Remaining tasks

  • Implement the missing requestToken_wait default setting.
  • Review for other inconsistent configuration key changes during refactoring.
  • Add automated tests if applicable to validate presence of required configuration.

User interface changes

None expected.

API changes

None expected. This is purely a configuration fix.

Data model changes

None expected, unless the configuration schema is updated to ensure correct defaults.

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇪🇸Spain eduardo morales alberti Spain, 🇪🇺

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024