Syntax error: unbalanced parenthesis in if statement - Smarty_Compiler.class.php

Hello, in my project with version 7.2.1 I am suddenly getting this error:

[Mon May 14 10: 24: 43.364467 2018] [: error] [pid 5994] [client :: 1: 58686] PHP Fatal error: Smarty error: [in cache / modules / Campaigns / EditView.tpl line 712]: syntax error: unbalanced parenthesis in if statement (Smarty_Compiler.class.php, line 1274) in /var/www//include/Smarty/Smarty.class.php on line 1095, referer: http: // localhost / /index.php?module=Campaigns&offset=1&stamp=1526286278080998200&return_module=Campaigns&action=DetailView&record=3f681828-46dc-6af3-632b-5aab8c332a74

when I try to edit a campaign This worked before, maybe it has affected you that I have added a new custom module, from Admin -> Module Builder, although it has nothing to do with the campaigns.

I have applied the solution
Could you tell me what can be done and how can it be solved? But the same error still occurs.

Could you tell me what could be failing and how could I solve it?

Thanks in advance and greetings,


If your error had the full call stack it would be much easier to see where that call is coming from. Can you get that? The bug is (probably) not in Smarty code, but in the SuiteCRM code that calls it.

Check your php_errors.log and give us the list of function calls below that message. These lines start with [0], [1], [2] etc.

Maybe you need XDEBUG installed and activated to see this, I’m not sure.

I have activated the error traces from the administration panel of the SuiteCRM and it is in the attached file.

I would try focusing here

That call is loading a TPL file that seems to have a mismatched parenthesis. Maybe you can just copy this statement from a few lines below

$GLOBALS['log']->fatal($app_strings['ERR_NO_SUCH_FILE'] .": $file");

and put it up there just before the Smarty call. Edit the log message a bit. Then check your logs for the file name immediately before the failure. Then go into that file and check parenthesis.

Putting said line, like this:

         if (is_file ($ this-> cacheDir. $ this-> templateDir. $ module. '/'. $ view. '.tpl')) {
             // Bug # 54634: RTC 18144: Can not add more than 1 user to role but popup is multi-selectable
             $ GLOBALS ['log'] -> fatal ($ app_strings ['ERR_NO_SUCH_FILE']. ": $ File");
             if (! isset ($ this-> ss))
                 $ this-> loadSmarty ();

Give this error:

[Mon May 14 12: 22: 21,742193 2018] [: error] [pid 7430] [client :: 1: 60342] PHP Notice: Undefined index: type in /var/www/project/include/TemplateHandler/TemplateHandler.php on line 479, referer: http: //localhost/sfcc/index.php? module = Campaigns & offset = 1 & stamp = 1526293337091540500 & return_module = Campaigns & action = DetailView & record = 3f681828-46dc-6af3-632b-5aab8c332a74

There is something very wrong with your code. You can’t have spaces after the dollar signs… and I don’t see how you code matches what I’m seeing.

I would change the function on the link above to this:

    function displayTemplate($module, $view, $tpl, $ajaxSave = false, $metaDataDefs = null) {
        if(!$this->checkTemplate($module, $view)) {
            $this->buildTemplate($module, $view, $tpl, $ajaxSave, $metaDataDefs);
        $file = $this->cacheDir . $this->templateDir . $module . '/' . $view . '.tpl';
        if(file_exists($file)) {
           $GLOBALS['log']->fatal("Loading TPL file: $file");   //  I just added this line *****************
           return $this->ss->fetch($file);
        } else {
           global $app_strings;
           $GLOBALS['log']->fatal($app_strings['ERR_NO_SUCH_FILE'] .": $file");
           return $app_strings['ERR_NO_SUCH_FILE'] .": $file";

If your code looks very different, and you still can’t make it work with the above example, please post your full displayTemplate function.

The blanks were by the Google Translator.

However, the value of $file is: cache/modules/Campaigns/EditView.tpl

Ok, what’s in that file? ANy mismatched parenthesis? :slight_smile:

Sorry, false alarm. It turns out that this campaign module had customized it but later I made a dump of a database that was not matched by this customization. And that’s why.

Anyway, thank you very much for your help :slight_smile: .