mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 10:24:26 +02:00
Fixed broken nesting and null handling.
This commit is contained in:
@@ -192,7 +192,7 @@ class Smarty_Internal_Compile_Foreach extends Smarty_Internal_Compile_Private_Fo
|
|||||||
$this->openTag(
|
$this->openTag(
|
||||||
$compiler,
|
$compiler,
|
||||||
'foreach',
|
'foreach',
|
||||||
array('foreach', $compiler->nocache, $local, $itemVar, empty($itemAttr) ? 0 : 1)
|
array('foreach', $compiler->nocache, $local, $itemVar, empty($itemAttr) ? 1 : 2)
|
||||||
);
|
);
|
||||||
// maybe nocache because of nocache variables
|
// maybe nocache because of nocache variables
|
||||||
$compiler->nocache = $compiler->nocache | $compiler->tag_nocache;
|
$compiler->nocache = $compiler->nocache | $compiler->tag_nocache;
|
||||||
@@ -220,7 +220,7 @@ class Smarty_Internal_Compile_Foreach extends Smarty_Internal_Compile_Private_Fo
|
|||||||
$output .= "{$itemVar}->index = -1;\n";
|
$output .= "{$itemVar}->index = -1;\n";
|
||||||
}
|
}
|
||||||
$output .= "{$itemVar}->do_else = true;\n";
|
$output .= "{$itemVar}->do_else = true;\n";
|
||||||
$output .= "foreach (\$_from as {$keyTerm}{$itemVar}->value) {\n";
|
$output .= "if (\$_from !== null) foreach (\$_from as {$keyTerm}{$itemVar}->value) {\n";
|
||||||
$output .= "{$itemVar}->do_else = false;\n";
|
$output .= "{$itemVar}->do_else = false;\n";
|
||||||
if (isset($attributes[ 'key' ]) && isset($itemAttr[ 'key' ])) {
|
if (isset($attributes[ 'key' ]) && isset($itemAttr[ 'key' ])) {
|
||||||
$output .= "\$_smarty_tpl->tpl_vars['{$key}']->value = {$itemVar}->key;\n";
|
$output .= "\$_smarty_tpl->tpl_vars['{$key}']->value = {$itemVar}->key;\n";
|
||||||
@@ -333,9 +333,6 @@ class Smarty_Internal_Compile_Foreachclose extends Smarty_Internal_CompileBase
|
|||||||
if ($restore === 2) {
|
if ($restore === 2) {
|
||||||
$output .= "{$itemVar} = {$local}saved;\n";
|
$output .= "{$itemVar} = {$local}saved;\n";
|
||||||
}
|
}
|
||||||
if ($restore > 0) {
|
|
||||||
$output .= "}\n";
|
|
||||||
}
|
|
||||||
$output .= "}\n";
|
$output .= "}\n";
|
||||||
/* @var Smarty_Internal_Compile_Foreach $foreachCompiler */
|
/* @var Smarty_Internal_Compile_Foreach $foreachCompiler */
|
||||||
$foreachCompiler = $compiler->getTagCompiler('foreach');
|
$foreachCompiler = $compiler->getTagCompiler('foreach');
|
||||||
|
Reference in New Issue
Block a user