From abf7e617c3fc9108fc56914938bf1945d92f9a93 Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Mon, 31 Mar 2014 12:53:55 -0500
Subject: [PATCH] Slight optimization for variable replacement

---
 include/class.variable.php | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/include/class.variable.php b/include/class.variable.php
index 233c9fc18..5d92709d9 100644
--- a/include/class.variable.php
+++ b/include/class.variable.php
@@ -82,16 +82,14 @@ class VariableReplacer {
         if (!$var || !method_exists($obj, 'getVar'))
             return "";
 
-        $parts = explode('.', $var);
-        if(($rv = call_user_func(array($obj, 'getVar'), $parts[0]))===false)
+        list($tag, $remainder) = explode('.', $var, 2);
+        if(($rv = call_user_func(array($obj, 'getVar'), $tag))===false)
             return "";
 
         if(!is_object($rv))
             return $rv;
 
-        list(, $part) = explode('.', $var, 2);
-
-        return $this->getVar($rv, $part);
+        return $this->getVar($rv, $remainder);
     }
 
     function replaceVars($input) {
-- 
GitLab