From bd60de4b42ae0bb7ac95c43953b8be1ff5394ac4 Mon Sep 17 00:00:00 2001 From: mohrt Date: Mon, 2 May 2005 14:03:18 +0000 Subject: [PATCH] add error message for empty if/elseif statements --- NEWS | 2 ++ libs/Smarty_Compiler.class.php | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/NEWS b/NEWS index fb24c6b4..e8e60e7e 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,5 @@ + - add error message for empty if/elseif statements (eykanal, + monte) - cast selected value to string for comparison in html_radios (Exeption, monte) - updated html_select_date's year_as_text-feature to be xhtml compliant diff --git a/libs/Smarty_Compiler.class.php b/libs/Smarty_Compiler.class.php index 51f35b56..47e17d8a 100644 --- a/libs/Smarty_Compiler.class.php +++ b/libs/Smarty_Compiler.class.php @@ -1250,6 +1250,13 @@ class Smarty_Compiler extends Smarty { $tokens = $match[0]; + if(empty($tokens)) { + $_error_msg .= $elseif ? "'elseif'" : "'if'"; + $_error_msg .= ' statement requires arguments'; + $this->_syntax_error($_error_msg, E_USER_ERROR, __FILE__, __LINE__); + } + + // make sure we have balanced parenthesis $token_count = array_count_values($tokens); if(isset($token_count['(']) && $token_count['('] != $token_count[')']) {