From 5f29e8305b9fdd97ccb07c090d782946286f560d Mon Sep 17 00:00:00 2001 From: Justin Hileman Date: Wed, 1 Aug 2012 23:08:50 -0700 Subject: [PATCH] Fix Context::find Don't ask closures about their methods or properties --- src/Mustache/Context.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Mustache/Context.php b/src/Mustache/Context.php index 6a2d57c..e7783b4 100644 --- a/src/Mustache/Context.php +++ b/src/Mustache/Context.php @@ -133,7 +133,7 @@ class Mustache_Context private function findVariableInStack($id, array $stack) { for ($i = count($stack) - 1; $i >= 0; $i--) { - if (is_object($stack[$i])) { + if (is_object($stack[$i]) && !$stack[$i] instanceof Closure) { if (method_exists($stack[$i], $id)) { return $stack[$i]->$id(); } elseif (isset($stack[$i]->$id)) {