Преглед изворни кода

Fix Context::find

Don't ask closures about their methods or properties
Justin Hileman пре 13 година
родитељ
комит
5f29e8305b
1 измењених фајлова са 1 додато и 1 уклоњено
  1. 1 1
      src/Mustache/Context.php

+ 1 - 1
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)) {