0

After a recent upgrade, we are not able to produce letters anymore. The error when trying is: Network Error Unable to reach the server. Please refresh this page in your browser and try again. This error happens when the pop-up window is trying to open to display the letter template and preview.

Digging a bit deeper, we can see the error:

Message was not parsed due to invalid smarty syntax : Smarty error: [in evaluated template line 10]: syntax error: (secure mode) 'call_user_func' not allowed in if statement (Smarty_Compiler.class.php, line 1398)

We have removed all tokens from the template, and disabled many extensions, yet the problem still persists.

Has anyone encountered this before and has a fix?

6
  • Do you have call_user_func in your template?
    – Demerit
    Commented May 23 at 15:40
  • I have removed all tokens from the message templates and still get the error. Not sure where the smarty templates are stored or generated from. Commented May 23 at 16:21
  • I'm seeing this in an if statement where the WYSIWYG is converting ampersands to &#039, trying to generate letters. Even though you've removed tokens, is there conditional logic somewhere in your letter template? Commented May 23 at 17:39
  • Lesley good thought - that is another cause of errors but here 039 is just a single quote being double escaped when outputting the message.
    – Demerit
    Commented May 23 at 18:13
  • Stephen when you say you don't know where the templates are, are these letters being created from a contribution search?
    – Demerit
    Commented May 23 at 18:16

2 Answers 2

1

We upgraded to Smarty 4 by adjusting civicrm.settings.php

define('CIVICRM_SMARTY_AUTOLOAD_PATH', '/home/agwstage/domains/staging.agw.ca/public_html/wp-content/plugins/civicrm/civicrm/packages/smarty4/vendor/autoload.php');

It resolved the problem. There were some old extensions that we disabled, but the message templates are working again.

0

If going to Smarty 3 / 4 / 5 isn't a possibility for you yet, I found that removing the {if call_user_func( blocks from templates/CRM/Contact/Form/Task/Help/Email.id-from_email.hlp resolves this specific issue as a temporary workaround.

Haven't figured out exactly why it's an issue yet. I can reproduce on a buildkit 5.73.3 site, but not on master.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.