Deprecated function : mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated dans Drupal\Component\Utility\Unicode::truncate() (/var/www/html/web/core/lib/Drupal/Component/Utility/Unicode.php ligne 310)

Created on 4 September 2025, about 1 month ago

Problem/Motivation

Message Deprecated function : mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated dans Drupal\Component\Utility\Unicode::truncate() (/var/www/html/web/core/lib/Drupal/Component/Utility/Unicode.php ligne 310)

#0 /var/www/html/web/core/includes/bootstrap.inc(166): _drupal_error_handler_real(8192, 'mb_strlen(): Pa...', '/var/www/html/w...', 310)
#1 [internal function]: _drupal_error_handler(8192, 'mb_strlen(): Pa...', '/var/www/html/w...', 310)
#2 /var/www/html/web/core/lib/Drupal/Component/Utility/Unicode.php(310): mb_strlen(NULL)
#3 /var/www/html/web/core/lib/Drupal/Core/Menu/MenuParentFormSelector.php(163): Drupal\Component\Utility\Unicode::truncate(NULL, 30, true, false)

Steps to reproduce

Having a menu link item with no title

Opening a node editing form that contains has the menu of above mentioned menu link enabled

Proposed resolution

drupal/web/core/lib/Drupal/Core/Menu/MenuParentFormSelector.php

currently

$title = $indent . ' ' . Unicode::truncate($link->getTitle(), 30, TRUE, FALSE);

replace by

$title = $link->getTitle() ?? '';
$title = $indent . ' ' . Unicode::truncate($title, 30, TRUE, FALSE);
🐛 Bug report
Status

Active

Version

10.4

Component

menu system

Created by

🇪🇸Spain abelass

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