NG Lightbox flooding logs with deprecation notice in PHP 8.1

Created on 6 January 2023, almost 2 years ago
Updated 16 January 2023, almost 2 years ago

Problem/Motivation

When using PHP 8.1, this NG Lightbox floods the logs with this warning if the module is enabled and nothing is set in the Paths textfield in the settings:

Deprecated function: strtolower(): Passing null to parameter #1 ($string) of type string is deprecated in Drupal\ng_lightbox\NgLightbox->isNgLightboxEnabledPath() (line 121 of modules/contrib/ng_lightbox/src/NgLightbox.php).

Steps to reproduce

Upgrade PHP to 8.1. Install the module but do not enter anything in the Paths setting at `/admin/config/media/ng-lightbox`.

Proposed resolution

Convert null to empty string before running through the strtolower function.

    $patterns = $this->config->get('patterns') ?? '';
    $patterns = strtolower($patterns);
🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

🇦🇺Australia jaydee1818 Melbourne

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024