diff --git a/NEWS b/NEWS index a710961c..e1516310 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,5 @@ - - added optional HTML header to output (Monte) + - fixed a bug that caused some nested includes to loop infinitely. (Andrei) + - added optional HTML header to output. (Monte) - significantly improved config_load performance. (Andrei) - added format attribute to math function. (Monte) - added html_select_time custom function. (Andrei) diff --git a/Smarty_Compiler.class.php b/Smarty_Compiler.class.php index c8845e4d..55d682f1 100644 --- a/Smarty_Compiler.class.php +++ b/Smarty_Compiler.class.php @@ -456,7 +456,11 @@ class Smarty_Compiler extends Smarty { " include \"\$file_name.php\";\n" . " }\n" . "}\n" . - "$include_func_name($include_file_name, get_defined_vars(), array(".implode(',', (array)$arg_list)."), \$_smarty_config);\n?>"; + "\$_smarty_defined_vars = get_defined_vars();\n" . + "unset(\$_smarty_defined_vars['file_name']);\n" . + "unset(\$_smarty_defined_vars['def_vars']);\n" . + "unset(\$_smarty_defined_vars['include_vars']);\n" . + "$include_func_name($include_file_name, \$_smarty_defined_vars, array(".implode(',', (array)$arg_list)."), \$_smarty_config);\n?>"; } /*======================================================================*\ diff --git a/libs/Smarty_Compiler.class.php b/libs/Smarty_Compiler.class.php index c8845e4d..55d682f1 100644 --- a/libs/Smarty_Compiler.class.php +++ b/libs/Smarty_Compiler.class.php @@ -456,7 +456,11 @@ class Smarty_Compiler extends Smarty { " include \"\$file_name.php\";\n" . " }\n" . "}\n" . - "$include_func_name($include_file_name, get_defined_vars(), array(".implode(',', (array)$arg_list)."), \$_smarty_config);\n?>"; + "\$_smarty_defined_vars = get_defined_vars();\n" . + "unset(\$_smarty_defined_vars['file_name']);\n" . + "unset(\$_smarty_defined_vars['def_vars']);\n" . + "unset(\$_smarty_defined_vars['include_vars']);\n" . + "$include_func_name($include_file_name, \$_smarty_defined_vars, array(".implode(',', (array)$arg_list)."), \$_smarty_config);\n?>"; } /*======================================================================*\