mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 19:04:27 +02:00
- bugfix implement Smarty2's behaviour of variables assigned by reference in SmartyBC. {assign} will affect all references.
(issue 88)
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
===== trunk =====
|
===== trunk =====
|
||||||
27.03.2012
|
27.03.2012
|
||||||
- bugfix prefilter did run multiple times on inline subtemplates compiled into several main templates (Forum Topic 21325)
|
- bugfix prefilter did run multiple times on inline subtemplates compiled into several main templates (Forum Topic 21325)
|
||||||
|
- bugfix implement Smarty2's behaviour of variables assigned by reference in SmartyBC. {assign} will affect all references.
|
||||||
|
(issue 88)
|
||||||
|
|
||||||
21.03.2012
|
21.03.2012
|
||||||
- bugfix compileAllTemplates() and compileAllConfig() did not return the number of compiled files (Forum Topic 21286)
|
- bugfix compileAllTemplates() and compileAllConfig() did not return the number of compiled files (Forum Topic 21286)
|
||||||
|
@@ -58,7 +58,14 @@ class Smarty_Internal_Compile_Assign extends Smarty_Internal_CompileBase {
|
|||||||
if (isset($parameter['smarty_internal_index'])) {
|
if (isset($parameter['smarty_internal_index'])) {
|
||||||
$output = "<?php \$_smarty_tpl->createLocalArrayVariable($_attr[var], $_nocache, $_scope);\n\$_smarty_tpl->tpl_vars[$_attr[var]]->value$parameter[smarty_internal_index] = $_attr[value];";
|
$output = "<?php \$_smarty_tpl->createLocalArrayVariable($_attr[var], $_nocache, $_scope);\n\$_smarty_tpl->tpl_vars[$_attr[var]]->value$parameter[smarty_internal_index] = $_attr[value];";
|
||||||
} else {
|
} else {
|
||||||
$output = "<?php \$_smarty_tpl->tpl_vars[$_attr[var]] = new Smarty_variable($_attr[value], $_nocache, $_scope);";
|
// implement Smarty2's behaviour of variables assigned by reference
|
||||||
|
if ($compiler->template->smarty instanceof SmartyBC) {
|
||||||
|
$output = "<?php if (isset(\$_smarty_tpl->tpl_vars[$_attr[var]])) {\$_smarty_tpl->tpl_vars[$_attr[var]] = clone \$_smarty_tpl->tpl_vars[$_attr[var]];";
|
||||||
|
$output .= "\n\$_smarty_tpl->tpl_vars[$_attr[var]]->value = $_attr[value]; \$_smarty_tpl->tpl_vars[$_attr[var]]->nocache = $_nocache; \$_smarty_tpl->tpl_vars[$_attr[var]]->scope = $_scope;";
|
||||||
|
$output .= "\n} else \$_smarty_tpl->tpl_vars[$_attr[var]] = new Smarty_variable($_attr[value], $_nocache, $_scope);";
|
||||||
|
} else {
|
||||||
|
$output = "<?php \$_smarty_tpl->tpl_vars[$_attr[var]] = new Smarty_variable($_attr[value], $_nocache, $_scope);";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ($_scope == Smarty::SCOPE_PARENT) {
|
if ($_scope == Smarty::SCOPE_PARENT) {
|
||||||
$output .= "\nif (\$_smarty_tpl->parent != null) \$_smarty_tpl->parent->tpl_vars[$_attr[var]] = clone \$_smarty_tpl->tpl_vars[$_attr[var]];";
|
$output .= "\nif (\$_smarty_tpl->parent != null) \$_smarty_tpl->parent->tpl_vars[$_attr[var]] = clone \$_smarty_tpl->tpl_vars[$_attr[var]];";
|
||||||
|
Reference in New Issue
Block a user