Do not crash in case of template parse error
parent
6e5062cfd1
commit
92dab3ce32
|
@ -178,6 +178,12 @@ class VMXTemplateCompiler
|
|||
$this->lexer->set_code($code);
|
||||
$this->lexer->feed($this->parser);
|
||||
|
||||
if ($this->st->functions['main']['body'] === '')
|
||||
{
|
||||
// Parse error
|
||||
unset($this->st->functions['main']);
|
||||
}
|
||||
|
||||
// Generate code for functions
|
||||
$code = '';
|
||||
foreach ($this->st->functions as $f)
|
||||
|
|
|
@ -297,6 +297,11 @@ class VMXTemplate
|
|||
}
|
||||
}
|
||||
}
|
||||
if (!isset($class::$functions[$func]))
|
||||
{
|
||||
$this->options->error("No function '$func' found in template $fn", true);
|
||||
return NULL;
|
||||
}
|
||||
$func = "fn_$func";
|
||||
$tpl = new $class($this);
|
||||
if ($vars)
|
||||
|
|
Loading…
Reference in New Issue