PHP8.2 deprecated passing null to string parameter

Created on 14 November 2023, about 1 year ago
Updated 18 April 2024, 8 months ago

Problem/Motivation

Several warnings are launched when the configuration values are empty (after fresh install), like

Deprecated function: strtotime(): Passing null to parameter #1 ($datetime) of type string is deprecated in extra_body_classes_preprocess_html() (line 105 of modules/contrib/extra_body_classes/extra_body_classes.module).

Steps to reproduce

With PHP8.2, after a fresh install, enable the module and load any page.

Proposed resolution

Use the coalesce operator to load an empty string if the config value is null. Patch included.

🐛 Bug report
Status

RTBC

Version

3.0

Component

Code

Created by

🇪🇸Spain somms Sevilla

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

Merge Requests

Comments & Activities

  • Issue created by @somms
  • I am seeing similar log messages with php 8.1 and version 8.x-3.0, have not tried the patch yet.

    Looking and I don't see a dev or more recent than 8.x-3.0.

  • Applied patch just now and will report back, so far that message has not showed up again.

  • First commit to issue fork.
  • 🇫🇷France Renrhaf 📍 Strasbourg 🐦🦜

    Hi himanshu_jhaloya,

    There is an issue with your patch :

    Warning: Undefined variable $timestamp_single_day_event in extra_body_classes_preprocess_html() (line 112 of modules/contrib/extra_body_classes/extra_body_classes.module).

    Otherwise the original issue is fixed

  • Status changed to Needs review 8 months ago
  • 🇮🇳India Rajan Kumar@2026

    @Renrhaf, applied the above and original has fixed, also i fixed Warning: Undefined variable $timestamp_single_day_event in extra_body_classes_preprocess_html() (line 112 of modules/contrib/extra_body_classes/extra_body_classes.module) error

    created Patch, please review it once.

  • Status changed to RTBC 8 months ago
  • 🇫🇷France Renrhaf 📍 Strasbourg 🐦🦜

    Hi Rajan Kumar, patch tested, it fixed the issue. Thanks !

Production build 0.71.5 2024