Error when using recurring formatter in Drupal 11

Created on 15 August 2024, 4 months ago
Updated 29 August 2024, 4 months ago

Problem/Motivation

I'm not 100% sure of the cause, but on a Drupal 11 site I got a fatal error using the recurring error in Drupal 11:
Drupal\Component\Utility\Html::escape(): Argument #1 ($text) must be of type string, null given, called in /var/www/html/web/core/lib/Drupal/Component/Render/FormattableMarkup.php on line 256

After some troubleshooting, I identified that the problem resides in smart-date-recurring-text-rule.html.twig, specifically this line:
{% trans %}{{ repeat }}{{ day_separator }}{{ day }}{{ month_separator }}{{ month }}{{ time_separator }}{{ time }}{{ limit_separator }}{{ limit }}{% endtrans %}

Further investigation revealed that the issue is actually the separators. Within SmartDateRule.php they default to NULL. Setting their default to an empty string instead resolve the fatal errors.

Proposed resolution

Update SmartDateRule.php to have the separator default to empty strings instead.

🐛 Bug report
Status

Fixed

Version

4.1

Component

Smart Date Recur

Created by

🇨🇦Canada mandclu

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