Fix Context::find
Don't ask closures about their methods or properties
This commit is contained in:
@@ -133,7 +133,7 @@ class Mustache_Context
|
|||||||
private function findVariableInStack($id, array $stack)
|
private function findVariableInStack($id, array $stack)
|
||||||
{
|
{
|
||||||
for ($i = count($stack) - 1; $i >= 0; $i--) {
|
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)) {
|
if (method_exists($stack[$i], $id)) {
|
||||||
return $stack[$i]->$id();
|
return $stack[$i]->$id();
|
||||||
} elseif (isset($stack[$i]->$id)) {
|
} elseif (isset($stack[$i]->$id)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user