With PHP 8.2: Deprecated function: strlen(): Passing null to parameter #1 ($string) of type string is deprecated

Created on 18 October 2023, about 1 year ago
Updated 29 November 2023, 12 months ago

Problem/Motivation

With PHP 8.2:

Deprecated function: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in Drupal\Component\Utility\Unicode::validateUtf8() (line 395 of core/lib/Drupal/Component/Utility/Unicode.php).
Drupal\Component\Utility\Unicode::validateUtf8(NULL) (Line: 65)
Drupal\Component\Utility\Xss::filter(NULL) (Line: 826)
bootstrap_barrio_preprocess_input(Array, 'input', Array)
call_user_func_array('bootstrap_barrio_preprocess_input', Array) (Line: 285)

Proposed resolution

In bootstrap_barrio.theme:

826: $variables['safe_value_label'] = Xss::filter($variables['attributes']['value']); -> $variables['safe_value_label'] = Xss::filter($variables['attributes']['value'] ?? '');

🐛 Bug report
Status

Fixed

Version

5.5

Component

Code

Created by

🇪🇸Spain tonibarbera

Live updates comments and jobs are added and updated live.
  • PHP 8.2

    The issue particularly affects sites running on PHP version 8.2.0 or later.

Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024