Merge branch 'dev' into feature/lambda-helper
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)) {
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Mustache.php.
|
||||||
|
*
|
||||||
|
* (c) 2012 Justin Hileman
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @group lambdas
|
||||||
|
* @group functional
|
||||||
|
*/
|
||||||
|
class Mustache_Test_FiveThree_Functional_ClosuresQuirksTest extends PHPUnit_Framework_TestCase
|
||||||
|
{
|
||||||
|
private $mustache;
|
||||||
|
|
||||||
|
public function setUp()
|
||||||
|
{
|
||||||
|
$this->mustache = new Mustache_Engine;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testClosuresDontLikeItWhenYouTouchTheirProperties()
|
||||||
|
{
|
||||||
|
$tpl = $this->mustache->loadTemplate('{{ foo.bar }}');
|
||||||
|
$this->assertEquals('', $tpl->render(array('foo' => function() { return 'FOO'; })));
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user