- bugfix multiple Smarty::fetch() of same template when $smarty->merge_compiled_includes = true; could cause function alreday defined error

This commit is contained in:
Uwe Tews
2015-02-12 23:56:43 +01:00
parent 0e87a99507
commit 6925c98af0
2 changed files with 8 additions and 3 deletions

View File

@@ -1,6 +1,9 @@
 ===== 3.1.22-dev ===== (xx.xx.2015)  ===== 3.1.22-dev ===== (xx.xx.2015)
12.02.2015
- bugfix multiple Smarty::fetch() of same template when $smarty->merge_compiled_includes = true; could cause function alreday defined error
11.02.2015 11.02.2015
- bugfix recursive {includes} did create E_NOTICE message when $smarty->$merge_compiled_includes = true; (github issue #16) - bugfix recursive {includes} did create E_NOTICE message when $smarty->merge_compiled_includes = true; (github issue #16)
22.01.2015 22.01.2015
- new feature security can now control access to static methods and properties - new feature security can now control access to static methods and properties

View File

@@ -39,7 +39,8 @@ class Smarty_Internal_Extension_CodeFrame
} }
$output .= "\$_valid = \$_smarty_tpl->decodeProperties(" . var_export($_template->properties, true) . ',' . ($cache ? 'true' : 'false') . ");\n"; $output .= "\$_valid = \$_smarty_tpl->decodeProperties(" . var_export($_template->properties, true) . ',' . ($cache ? 'true' : 'false') . ");\n";
$output .= "/*/%%SmartyHeaderCode%%*/\n"; $output .= "/*/%%SmartyHeaderCode%%*/\n";
$output .= "if (\$_valid && !is_callable('{$_template->properties['unifunc']}')) {function {$_template->properties['unifunc']} (\$_smarty_tpl) {\n"; $output .= "if (\$_valid && !is_callable('{$_template->properties['unifunc']}')) {\n";
$output .= "function {$_template->properties['unifunc']} (\$_smarty_tpl) {\n";
// include code for plugins // include code for plugins
if (!$cache) { if (!$cache) {
if (!empty($_template->required_plugins['compiled'])) { if (!empty($_template->required_plugins['compiled'])) {
@@ -82,11 +83,12 @@ class Smarty_Internal_Extension_CodeFrame
} }
$output = "<?php\n"; $output = "<?php\n";
$output .= "/*%%SmartyHeaderCode:{$_template->properties['nocache_hash']}%%*/\n"; $output .= "/*%%SmartyHeaderCode:{$_template->properties['nocache_hash']}%%*/\n";
$output .= "if (\$_valid && !is_callable('{$_template->properties['unifunc']}')) {\n";
$output .= "function {$_template->properties['unifunc']} (\$_smarty_tpl) {\n"; $output .= "function {$_template->properties['unifunc']} (\$_smarty_tpl) {\n";
$output .= "?>\n" . $content; $output .= "?>\n" . $content;
$output .= "<?php\n"; $output .= "<?php\n";
$output .= "/*/%%SmartyNocache:{$_template->properties['nocache_hash']}%%*/\n"; $output .= "/*/%%SmartyNocache:{$_template->properties['nocache_hash']}%%*/\n";
$output .= "}\n?>"; $output .= "}\n}\n?>";
return $output; return $output;
} }
} }