You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shindig.apache.org by ch...@apache.org on 2009/07/22 23:35:51 UTC

svn commit: r796886 - /incubator/shindig/trunk/php/src/gadgets/templates/ExpressionParser.php

Author: chabotc
Date: Wed Jul 22 21:35:51 2009
New Revision: 796886

URL: http://svn.apache.org/viewvc?rev=796886&view=rev
Log:
The expression parser got false positives by not checking if it was already in a variable name (ie color would trigger isOperator(or)

Modified:
    incubator/shindig/trunk/php/src/gadgets/templates/ExpressionParser.php

Modified: incubator/shindig/trunk/php/src/gadgets/templates/ExpressionParser.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/templates/ExpressionParser.php?rev=796886&r1=796885&r2=796886&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/templates/ExpressionParser.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/templates/ExpressionParser.php Wed Jul 22 21:35:51 2009
@@ -202,7 +202,6 @@
   }
 
   static private function isOperand($string, $index = 0) {
-
     if (is_array($string)) {
       // complex types are always operands
       return true;
@@ -422,10 +421,10 @@
         $temp = '';
         continue;
       }
-      if (self::isOperand($str, $i)) {
+      if (!empty($temp) || self::isOperand($str, $i)) {
         $temp = $temp . $str[$i];
       }
-      $tokenLen = self::isOperator($str, $i);
+      $tokenLen = empty($temp) ? self::isOperator($str, $i) : false;
       if ($tokenLen || $str[$i] == ")" || $str[$i] == "(") {
         $token = substr($str, $i, $tokenLen);
         if ($tokenLen > 1) {
@@ -445,7 +444,6 @@
         }
       }
     }
-
     // Resolve all named variables to their actual value
     foreach ($tokens as $key => $val) {
       if (self::isOperand($val) && ! is_numeric($val) && $val !== false && $val !== null) {