Skip to content

Smarty 5 incompatibility in jcalendar.tpl: unknown modifier uniqid when creating new mandate (CiviCRM 6.2) #751

@vasyugan

Description

@vasyugan

ChatGPT helped me with formulating this issue report, so I am not nearly as smart as it sounds...

I'm running CiviCRM 6.2 on Ubuntu 20.04 with PHP 8.1 and on Debian Bookworm with PHP 8.2 and encountered a Smarty 5 compatibility issue when attempting to create a new SEPA mandate via the CiviSEPA extension.

When I try to create a mandate for a contact, I get the following error:


Smarty\CompilerException: "Syntax error in template "file:CRM/common/jcalendar.tpl" on line 41 
"{assign var='displayDate' value=$elementId|cat:"_display"|cat:"_$string"|uniqid}" 
unknown modifier 'uniqid'"

This happens because uniqid is being used as a Smarty modifier, but Smarty 5 doesn't recognize it by default, and it hasn't been registered as a custom plugin. This breaks rendering of the form used to create SEPA mandates.

Environment:

  • CiviCRM 6.2
  • org.project60.sepa (latest as of May 2025)
  • PHP 8.1/8.2
  • Standalone installation, Also WordPress Plugin

Suggestion:
To fix this, either:

  • Replace the use of |uniqid with a method that conforms to Smarty 5 syntax, e.g. generate uniqid() in PHP and pass it to the template
  • Or refactor the line in jcalendar.tpl like this (pseudocode):
{assign var="uniqid" value=$php.uniqid()}
{assign var='displayDate' value=$elementId|cat:"_display"|cat:"_$string"|cat:$uniqid}

But ideally, remove usage of unsupported Smarty modifiers entirely for forward compatibility with Smarty 5.

Let me know if you'd like me to test a patch. Thanks for maintaining this excellent extension!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions