- bugfix change of 11.03.2014 cause again {capture} data could not been seen in other templates with {$smarty.capture.name} https://github.com/smarty-php/smarty/issues/153

This commit is contained in:
uwetews
2016-03-27 18:44:19 +02:00
parent ff6a8521bb
commit 2dac1729c2
4 changed files with 16 additions and 8 deletions
@@ -37,6 +37,13 @@ class Smarty_Internal_Runtime_Capture
*/
private $countStack = array();
/**
* Named buffer
*
* @var string[]
*/
private $namedBuffer = array();
/**
* Flag if callbacks are registered
*
@@ -84,7 +91,6 @@ class Smarty_Internal_Runtime_Capture
{
$this->countStack[] = $this->captureCount;
$this->captureCount = 0;
$_template->_cache[ 'capture' ] = array();
}
/**
@@ -105,7 +111,7 @@ class Smarty_Internal_Runtime_Capture
if (isset($append)) {
$_template->append($append, ob_get_contents());
}
$_template->_cache[ 'capture' ][ $buffer ] = ob_get_clean();
$this->namedBuffer[ $buffer ] = ob_get_clean();
} else {
$this->error($_template);
}
@@ -133,7 +139,7 @@ class Smarty_Internal_Runtime_Capture
*/
public function getBuffer(Smarty_Internal_Template $_template, $name)
{
return isset($_template->_cache[ 'capture' ][ $name ]) ? $_template->_cache[ 'capture' ][ $name ] : null;
return isset($this->namedBuffer[ $name ]) ? $this->namedBuffer[ $name ] : null;
}
/**