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

[email protected] ("boots") Wed, 21 Dec 2005 18:09:23 -0000
Newsgroups php.smarty.cvs
Message-ID <cvsboots1135188563@cvsserver>
boots		Wed Dec 21 18:09:23 2005 EDT

  Modified files:              
    /smarty	NEWS 
    /smarty/libs	Smarty_Compiler.class.php 
  Log:
  Fix improper tokenization of certain inline math expressions.
  
  Thanks to gerard at forums for reporting this.
  
http://cvs.php.net/viewcvs.cgi/smarty/NEWS?r1=1.521&r2=1.522&diff_format=u
Index: smarty/NEWS
diff -u smarty/NEWS:1.521 smarty/NEWS:1.522
--- smarty/NEWS:1.521	Wed Dec 14 16:02:31 2005
+++ smarty/NEWS	Wed Dec 21 18:09:23 2005
@@ -1,3 +1,5 @@
+ - fixed improper tokenization of certain inline math expressions (boots)
+
 Version 2.6.11 (Dec 14, 2005)
 -----------------------------
 
http://cvs.php.net/viewcvs.cgi/smarty/libs/Smarty_Compiler.class.php?r1=1.374&r2=1.375&diff_format=u
Index: smarty/libs/Smarty_Compiler.class.php
diff -u smarty/libs/Smarty_Compiler.class.php:1.374 smarty/libs/Smarty_Compiler.class.php:1.375
--- smarty/libs/Smarty_Compiler.class.php:1.374	Wed Dec 14 14:53:55 2005
+++ smarty/libs/Smarty_Compiler.class.php	Wed Dec 21 18:09:23 2005
@@ -26,7 +26,7 @@
  * @package Smarty
  */
 
-/* $Id: Smarty_Compiler.class.php,v 1.374 2005/12/14 14:53:55 mohrt Exp $ */
+/* $Id: Smarty_Compiler.class.php,v 1.375 2005/12/21 18:09:23 boots Exp $ */
 
 /**
  * Template compiling class
@@ -1379,7 +1379,7 @@
                                !in_array($token, $this->security_settings['IF_FUNCS'])) {
                                 $this->_syntax_error("(secure mode) '$token' not allowed in if statement", E_USER_ERROR, __FILE__, __LINE__);
                             }
-                    } elseif(preg_match('~^' . $this->_var_regexp . '$~', $token) && isset($tokens[$i+1]) && $tokens[$i+1] == '(') {
+                    } elseif(preg_match('~^' . $this->_var_regexp . '$~', $token) && (strpos('+-*/^%&|', substr($token, -1)) === false) && isset($tokens[$i+1]) && $tokens[$i+1] == '(') {
                         // variable function call
                         $this->_syntax_error("variable function call '$token' not allowed in if statement", E_USER_ERROR, __FILE__, __LINE__);                      
                     } elseif(preg_match('~^' . $this->_obj_call_regexp . '|' . $this->_var_regexp . '(?:' . $this->_mod_regexp . '*)$~', $token)) {