mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 10:24:26 +02:00
- bugfix {foreach} if key variable and item@key attribute have been used both the key variable was not updated https://github.com/smarty-php/smarty/issues/254
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
===== 3.1.30-dev ===== (xx.xx.xx)
|
||||
18.07.2016
|
||||
- bugfix {foreach} if key variable and item@key attribute have been used both the key variable was not updated https://github.com/smarty-php/smarty/issues/254
|
||||
|
||||
14.07.2016
|
||||
- bugfix wrong parameter on compileAllTemplates() and compileAllConfig() https://github.com/smarty-php/smarty/issues/231
|
||||
|
||||
|
@@ -121,7 +121,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
||||
/**
|
||||
* smarty version
|
||||
*/
|
||||
const SMARTY_VERSION = '3.1.30-dev/80';
|
||||
const SMARTY_VERSION = '3.1.30-dev/81';
|
||||
|
||||
/**
|
||||
* define variable scopes
|
||||
|
@@ -176,11 +176,11 @@ class Smarty_Internal_Compile_Foreach extends Smarty_Internal_Compile_Private_Fo
|
||||
$itemAttr[ 'total' ] = true;
|
||||
}
|
||||
$keyTerm = '';
|
||||
if (isset($attributes[ 'key' ])) {
|
||||
$keyTerm = "\$_smarty_tpl->tpl_vars['{$key}']->value => ";
|
||||
}
|
||||
if (isset($itemAttr[ 'key' ])) {
|
||||
$keyTerm = "{$itemVar}->key => ";
|
||||
unset($itemAttr[ 'key' ]);
|
||||
} elseif (isset($attributes[ 'key' ])) {
|
||||
$keyTerm = "\$_smarty_tpl->tpl_vars['{$key}']->value => ";
|
||||
}
|
||||
if ($this->isNamed) {
|
||||
$foreachVar = "\$_smarty_tpl->tpl_vars['__smarty_foreach_{$attributes['name']}']";
|
||||
|
Reference in New Issue
Block a user