PHP8.1 strncasecmp() Passing null to parameter #1 ($string1) of type string is deprecated

Created on 27 January 2023, almost 2 years ago
Updated 1 February 2023, almost 2 years ago

Problem/Motivation

With PHP 8 the first parameter of strncasecmp() can no longer be NULL.

Steps to reproduce

  1. Be running Drupal 7 using PHP 8.0+.
  2. Create a new node that is set unpublish (also works with editing an existing one) and set a value in the scheduler field, and save
  3. The error message Deprecated function: strncasecmp(): Passing null to parameter #1 ($string1) of type string is deprecated in _scheduler_strptime()[...] will occur.

    Proposed resolution

    When initialising $results, set 'meridiem' either to an empty string or 'am', or potentially move the two morning/afternoon check into a conditional block that checks $results['meridiem'] !== NULL

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇬🇧United Kingdom magicmyth

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

Comments & Activities

Production build 0.71.5 2024