I am getting two issues after upgrade from 5.58 to 5.63 related to Smarty in message templates.

In one case, the location_type_id no longer seems to valid.

{capture assign=type}{contact.address_primary.location_type_id:label}{/capture}   
{if $type == Work}{$employer}{/if}

syntax error: (secure mode) 'Work' not allowed in if statement (Smarty_Compiler.class.php, line 1398)

Perplexingly in the other, != NULL does not see to be a valid operator value combination.

{capture assign=donor_port}{contact.custom_65}{/capture}
{if $donor_port != NULL}
Donor Portfolio: {$donor_port}

syntax error: (secure mode) 'NULL' not allowed in if statement (Smarty_Compiler.class.php, line 1398)

Any ideas what the replacements for these are, is there new syntax documentation?

1 Answer 1


I'm not sure these changes would be considered a "new" syntax rather than a stricter enforcement of existing syntax, causing heretofore-unnoticed syntax errors to rear their heads.

For the first, the string needs to be quoted. Unquoted strings throw a notice at least, or I think an error in later versions of PHP. So it should be:

{if $type == 'Work'}{$employer}{/if}

For the second, {capture} always captures a string (whatever is inside the {capture}{/capture}) so will never be anything other than a string. You could change your conditional to {if $donor_port != ''}, or simplify it further to {if $donor_port}.

  • Thank you @Coleman. Quotes fixed it Sep 5, 2023 at 16:21
  • No problem, although looking at it again, the only thing inside your {capture} is another token, so why not use that token directly? I don't think capturing it serves any purpose.
    – Coleman
    Sep 5, 2023 at 20:07

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.