Per the updated spec, interpolated lambdas should not be cached.

This commit is contained in:
Justin Hileman
2011-03-05 12:14:02 -05:00
parent d7cee29402
commit 14911a158e
+1 -9
View File
@@ -72,11 +72,6 @@ class Mustache {
protected $_localPragmas = array(); protected $_localPragmas = array();
/**
* Interpolated lambdas should be called only once... store 'em for later here
*/
protected $_interpolatedLambdas = array();
/** /**
* Mustache class constructor. * Mustache class constructor.
* *
@@ -614,10 +609,7 @@ class Mustache {
if ($this->_varIsCallable($val)) { if ($this->_varIsCallable($val)) {
$key = is_object($val) ? spl_object_hash($val) : serialize($val); $key = is_object($val) ? spl_object_hash($val) : serialize($val);
if (!isset($this->_interpolatedLambdas[$key])) { return $this->_renderTemplate(call_user_func($val));
$this->_interpolatedLambdas[$key] = call_user_func($val);
}
return $this->_renderTemplate($this->_interpolatedLambdas[$key]);
} }
return $val; return $val;