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.

Issue fork smart_date-3468277

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mandclu created an issue. See original summary.

  • mandclu committed 7832db58 on 4.1.x
    Issue #3468277 by mandclu: Error when using recurring formatter in...
mandclu’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.