cvs: smarty / NEWS /libs Smarty_Compiler.class.php

[email protected] ("Monte Ohrt")
Newsgroups php.smarty.cvs
Message-ID <cvsmohrt1115042598@cvsserver>
mohrt		Mon May  2 10:03:18 2005 EDT

  Modified files:              
    /smarty	NEWS 
    /smarty/libs	Smarty_Compiler.class.php 
  Log:
  add error message for empty if/elseif statements
  
  
http://cvs.php.net/diff.php/smarty/NEWS?r1=1.500&r2=1.501&ty=u
Index: smarty/NEWS
diff -u smarty/NEWS:1.500 smarty/NEWS:1.501
--- smarty/NEWS:1.500	Fri Apr 15 12:32:29 2005
+++ smarty/NEWS	Mon May  2 10:03:17 2005
@@ -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
http://cvs.php.net/diff.php/smarty/libs/Smarty_Compiler.class.php?r1=1.368&r2=1.369&ty=u
Index: smarty/libs/Smarty_Compiler.class.php
diff -u smarty/libs/Smarty_Compiler.class.php:1.368 smarty/libs/Smarty_Compiler.class.php:1.369
--- smarty/libs/Smarty_Compiler.class.php:1.368	Thu Mar 31 09:57:19 2005
+++ smarty/libs/Smarty_Compiler.class.php	Mon May  2 10:03:18 2005
@@ -26,7 +26,7 @@
  * @package Smarty
  */
 
-/* $Id: Smarty_Compiler.class.php,v 1.368 2005/03/31 14:57:19 mohrt Exp $ */
+/* $Id: Smarty_Compiler.class.php,v 1.369 2005/05/02 14:03:18 mohrt Exp $ */
 
 /**
  * Template compiling class
@@ -1250,6 +1250,13 @@
 
         $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[')']) {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.