Per the updated spec, interpolated lambdas should not be cached.
This commit is contained in:
+1
-9
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user