- bugfix extends resource did not work with user defined left/right delimiter https://github.com/smarty-php/smarty/issues/419

This commit is contained in:
Uwe Tews
2018-03-16 18:44:47 +01:00
parent 93909aacf8
commit a5961606f3
4 changed files with 13 additions and 6 deletions

View File

@@ -1,4 +1,7 @@
===== 3.1.32 - dev ===
16.03.2018
- bugfix extends resource did not work with user defined left/right delimiter https://github.com/smarty-php/smarty/issues/419
22.11.2017
- bugfix {break} and {continue} could fail if {foreach}{/foreach} did contain other
looping tags like {for}, {section} and {while} https://github.com/smarty-php/smarty/issues/323

View File

@@ -112,7 +112,7 @@ class Smarty extends Smarty_Internal_TemplateBase
/**
* smarty version
*/
const SMARTY_VERSION = '3.1.32-dev-38';
const SMARTY_VERSION = '3.1.32-dev-39';
/**
* define variable scopes
*/
@@ -1270,6 +1270,7 @@ class Smarty extends Smarty_Internal_TemplateBase
* @param string $name property name
*
* @return mixed
* @throws \SmartyException
*/
public function __get($name)
{
@@ -1293,6 +1294,8 @@ class Smarty extends Smarty_Internal_TemplateBase
*
* @param string $name property name
* @param mixed $value parameter passed to setter
*
* @throws \SmartyException
*/
public function __set($name, $value)
{

View File

@@ -135,16 +135,17 @@ class Smarty_Internal_Compile_Extends extends Smarty_Internal_Compile_Shared_Inh
/**
* Create source code for {extends} from source components array
*
* @param []\Smarty_Internal_Template_Source $components
* @param \Smarty_Internal_Template $template
*
* @return string
*/
public static function extendsSourceArrayCode($components)
public static function extendsSourceArrayCode(Smarty_Internal_Template $template)
{
$resources = array();
foreach ($components as $source) {
foreach ($template->source->components as $source) {
$resources[] = $source->resource;
}
return '{extends file=\'extends:' . join('|', $resources) . '\' extends_resource=true}';
return $template->smarty->left_delimiter . 'extends file=\'extends:' . join('|', $resources) .
'\' extends_resource=true' . $template->smarty->right_delimiter;
}
}

View File

@@ -394,7 +394,7 @@ abstract class Smarty_Internal_TemplateCompilerBase
// we have array of inheritance templates by extends: resource
// generate corresponding source code sequence
$_content =
Smarty_Internal_Compile_Extends::extendsSourceArrayCode($this->template->source->components);
Smarty_Internal_Compile_Extends::extendsSourceArrayCode($this->template);
} else {
// get template source
$_content = $this->template->source->getContent();