Search code examples
phpsmartysmarty3

Smarty shows errors from compiled files


I'm using Smarty3 as a template engine and every time I have a PHP warning or notice from within a template it tells me something like this:

Notice: Undefined index: tab in C:\xampp\htdocs\<project>\cms\application\tmp\compile\2ca7baf79266ad8c26c12b77578df81e640dbf89.file.index.phtml.php on line 66

I know how to solve this error, but this message doesn't give me a clue in which file the error occurs. Is there a way for Smarty to tell me the real/original file I have to be looking for to fix the error?

Again, my problem is not that I can't find the error. The problem is that Smarty doesn't tell me in which file and line to find the error.

Also, the error message is not correct, as the following code caused it:

{if count($tab['columns']) > 0} 
...
{/if}

It's not the index thats undefined, but the variable. How can this be?


Solution

  • The solution to the problem was to update Smarty to the latest version.