Notice from autotitle_node_presave hook in some cases.

Created on 9 February 2024, about 1 year ago
Updated 23 February 2024, about 1 year ago

Problem/Motivation

Deprecated function: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in Drupal\Component\Utility\Html::load() (line 285 of /var/www/web/core/lib/Drupal/Component/Utility/Html.php)
#0 /var/www/web/core/includes/bootstrap.inc(164): _drupal_error_handler_real(8192, 'str_replace(): ...', '/var/www/web/co...', 285)
#1 [internal function]: _drupal_error_handler(8192, 'str_replace(): ...', '/var/www/web/co...', 285)
#2 /var/www/web/core/lib/Drupal/Component/Utility/Html.php(285): str_replace(Array, '\n', NULL)
#3 /var/www/web/modules/contrib/autotitle/autotitle.module(194): Drupal\Component\Utility\Html::load(NULL)

   $dom = Html::load($content->value); 
when $content->value is null, in HTML:Load $html (null) is put to  $html = str_replace(["\r\n", "\r"], "\n", $html); what is Deprecated.

Proposed resolution

add convert to '' when value is null $dom = Html::load($content->value ?? '');

πŸ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡΅πŸ‡±Poland Pawelgorski87

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