From ebb380d479115e26ba1b2c505c83eff68f1aa345 Mon Sep 17 00:00:00 2001 From: Peter Rotich <peter@enhancesoft.com> Date: Fri, 20 Dec 2013 14:44:23 +0000 Subject: [PATCH] Make variable replacer __call aware is_callable will report ANY function as available --- include/class.variable.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/class.variable.php b/include/class.variable.php index 36d49e6a3..76ad8c12d 100644 --- a/include/class.variable.php +++ b/include/class.variable.php @@ -63,11 +63,12 @@ class VariableReplacer { if(!$obj) return ""; - if(!$var && is_callable(array($obj, 'asVar'))) + if (!$var && method_exists($obj, 'asVar')) //XXX: to_string? return call_user_func(array($obj, 'asVar')); list($v, $part) = explode('.', $var, 2); - if($v && is_callable(array($obj, 'get'.ucfirst($v)))) { + if ($v && method_exists($obj, 'get'.ucfirst($v)) + && is_callable(array($obj, 'get'.ucfirst($v)))) { $rv = call_user_func(array($obj, 'get'.ucfirst($v))); if(!$rv || !is_object($rv)) return $rv; @@ -75,7 +76,7 @@ class VariableReplacer { return $this->getVar($rv, $part); } - if(!$var || !is_callable(array($obj, 'getVar'))) + if (!$var || !method_exists($obj, 'getVar')) return ""; $parts = explode('.', $var); -- GitLab