- bugfix {if} and {while} tags without condition did not throw a SmartyCompilerException (Issue #57)

This commit is contained in:
uwe.tews@googlemail.com
2011-11-01 20:27:53 +00:00
parent 4f4cb7847d
commit d3e71dabb6
3 changed files with 73 additions and 57 deletions

View File

@@ -1,4 +1,7 @@
===== trunk =====
01.11.2011
- bugfix {if} and {while} tags without condition did not throw a SmartyCompilerException (Issue #57)
22.10.2011
- bugfix smarty_mb_from_unicode() would not decode unicode-points properly
- bugfix use catch Exception instead UnexpectedValueException in

View File

@@ -32,6 +32,11 @@ class Smarty_Internal_Compile_If extends Smarty_Internal_CompileBase {
$this->openTag($compiler, 'if', array(1, $compiler->nocache));
// must whole block be nocache ?
$compiler->nocache = $compiler->nocache | $compiler->tag_nocache;
if (!array_key_exists("if condition",$parameter)) {
$compiler->trigger_template_error("missing if condition", $compiler->lex->taglineno);
}
if (is_array($parameter['if condition'])) {
if ($compiler->nocache) {
$_nocache = ',true';
@@ -108,6 +113,10 @@ class Smarty_Internal_Compile_Elseif extends Smarty_Internal_CompileBase {
list($nesting, $compiler->tag_nocache) = $this->closeTag($compiler, array('if', 'elseif'));
if (!array_key_exists("if condition",$parameter)) {
$compiler->trigger_template_error("missing elseif condition", $compiler->lex->taglineno);
}
if (is_array($parameter['if condition'])) {
$condition_by_assign = true;
if ($compiler->nocache) {

View File

@@ -31,6 +31,10 @@ class Smarty_Internal_Compile_While extends Smarty_Internal_CompileBase {
$_attr = $this->getAttributes($compiler, $args);
$this->openTag($compiler, 'while', $compiler->nocache);
if (!array_key_exists("if condition",$parameter)) {
$compiler->trigger_template_error("missing while condition", $compiler->lex->taglineno);
}
// maybe nocache because of nocache variables
$compiler->nocache = $compiler->nocache | $compiler->tag_nocache;
if (is_array($parameter['if condition'])) {